I wrote this for my Arduino megaMega 2560:
int LED[14] = { 28,29,30,31,32,33,34,35,36,37,38,39,40,41 } ;
...
... (some other code like setup(), etc. Note:pinmode output for this 14 leds wich pins is defined in
... array named LED[]
...
void intro(){
for(int j=1; j<100; j++ ){
for(int r=1; r<15; r++ ){ digitalWrite(LED[r],HIGH); delay(100); }
delay(100);
for(int r=1; r<15; r++ ){digitalWrite(LED[r],LOW); delay(100);}
delay(100);
}
Serial.print("Pattern started");
delay(1000);
}
So when iI run this script, iI expect that each ledLED will light up in the sequence and remaining lightedremain lit until the second loploop to turn it off, but iI see that when lighting each ledLED, when lighting the 9th ledLED, the first 8 ledLEDs shut off unexplicatelyinexplicably and the ledLEDs 9 trougthrough 14 light one by one, remaining lightlit. thatThat I expected but why do the first 8 ledLEDs shut off before the lopploop ends and the second loop appear ??starts? Excuse my bad englis