add more leds?

dear Becky the sketch compile and work fine with the exemption of the last led who light dim

I suspect a wrong resistor value, no was good a bad led,no was good ,change to another pin ,no luck

make a slow delay and measure the volts out ,on the first four 4,8 on the last just 1.7 ,no errors nothing wrong even change boards

int d = 1500;

void setup(){

for (int led = 6; led < 10; led++){ //set pins 6 to 10 as output

pinMode(led,OUTPUT);

}

}

void loop(){

for (int led=6; led < 10; led++){ // loop go up

digitalWrite(led, HIGH );

delay (d);

digitalWrite(led,LOW);

}

for (int led = 10;led > 6;led--){ //loop go down

digitalWrite(led,HIGH);

delay (d);

digitalWrite(led,LOW);

}

}


bekathwia7 months ago

A dim LED with no other symptoms is usually a failure to declare that pin as an output at the start. Take a look at the bounds of your for loops-- you set pins 6, 7, 8, and 9 as outputs in the setup, but later on your decrementing for loop starts at 10. play around with those numbers and remember that < and <= mean two different things!