hi there,
im learning arduino programing, and came across a rly annoying thing. im sure my programing skill is the reason i have this problem, but i cant find an answer on the internet about my problem so im hoping to get hlp here.
so i wanted to make a led chaser program and started off with a simlpe code... defined all the outputs i wanted (pinmode(3, OUTPUT), pinmode(4, OUTPUT)...), in the loop section did the digilalwritefunction and delay for every led... worked well. then i said, ok, i dont want to type the same thing for every output separately... so i made a loop... i used while, but i dont thing it matters here what type of loop i chose.
this is the code:
int pin;
void setup() {
pinMode(pin, OUTPUT);
}
void loop() {
pin = 3;
while (pin<=6)
{
digitalWrite(pin, HIGH);
delay(1000);
digitalWrite(pin, LOW);
pin++;
}
}
when i uplaoded the code to my arduino uno, it did what i wanted, but the leds werent lighting up as much as they should (tried smaller resistors and everything). the board isnt damaged, nor the uC... everything works well with examples, with the previous code also.
what am i doing wrog? i know the is in the setup funcition, but i cant figure out why it wont do as i told him
pls help me and thanks in advace