Skip to main content
deleted 31 characters in body; edited title
Source Link
dda
  • 1.6k
  • 1
  • 12
  • 17

Arduino Mega led dontLED doesn't light as expected

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

Arduino Mega led dont light as expected

I wrote this for my Arduino mega 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 i run this script, i expect that each led will light up in the sequence and remaining lighted until the second lop to turn it off but i see that when lighting each led, when lighting the 9th led, the first 8 led shut off unexplicately and the led 9 troug 14 light one by one remaining light. that I expected but why the first 8 led shut off before the lopp ends and the second loop appear ??? Excuse my bad englis

Arduino Mega LED doesn't light as expected

I wrote this for my Arduino Mega 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 I run this script, I expect that each LED will light up in the sequence and remain lit until the second loop to turn it off, but I see that when lighting each LED, when lighting the 9th LED, the first 8 LEDs shut off inexplicably and LEDs 9 through 14 light one by one, remaining lit. That I expected but why do the first 8 LEDs shut off before the loop ends and the second loop starts?

added 60 characters in body
Source Link
Juraj
  • 18.2k
  • 4
  • 30
  • 49

I wrote this for my Arduino mega 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); }

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 i run this script, i expect that each led will light up in the sequence and remaining lighted until the second lop to turn it off but i see that when lighting each led, when lighting the 9th led, the first 8 led shut off unexplicately and the led 9 troug 14 light one by one remaining light. that I expected but why the first 8 led shut off before the lopp ends and the second loop appear ??? Excuse my bad englis

I wrote this for my Arduino mega 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 i run this script, i expect that each led will light up in the sequence and remaining lighted until the second lop to turn it off but i see that when lighting each led, when lighting the 9th led, the first 8 led shut off unexplicately and the led 9 troug 14 light one by one remaining light. that I expected but why the first 8 led shut off before the lopp ends and the second loop appear ??? Excuse my bad englis

I wrote this for my Arduino mega 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 i run this script, i expect that each led will light up in the sequence and remaining lighted until the second lop to turn it off but i see that when lighting each led, when lighting the 9th led, the first 8 led shut off unexplicately and the led 9 troug 14 light one by one remaining light. that I expected but why the first 8 led shut off before the lopp ends and the second loop appear ??? Excuse my bad englis

Source Link

Arduino Mega led dont light as expected

I wrote this for my Arduino mega 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 i run this script, i expect that each led will light up in the sequence and remaining lighted until the second lop to turn it off but i see that when lighting each led, when lighting the 9th led, the first 8 led shut off unexplicately and the led 9 troug 14 light one by one remaining light. that I expected but why the first 8 led shut off before the lopp ends and the second loop appear ??? Excuse my bad englis