So, I've just started programming Arduino (and also in general), so I'm doing basic things, like switching on and off LED's.
I've made them light in a sequence and then turning them off (in the same sequence), and now I wanted to use 2 buttons, one to make them do the same thing as before (light and turning LED's off in sequence) repeatedly, and the other to turn them off.
The problem is that curently they only light up once, and not repeatedly, I think I would've needed another loop, but i found out that you can't use 2 of them.
Can anyone help me? here's the code
int LED1 = 2;
int LED2 = 3;
int LED3 = 4;
int LED4 = 5;
int LED5 = 6;
int buttonON = 7;
int buttonOFF = 8;
void setup()
{
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(LED4, OUTPUT);
pinMode(LED5, OUTPUT);
pinMode(buttonON, INPUT_PULLUP);
pinMode(buttonOFF, INPUT_PULLUP);
}
void loop ()
{
if (digitalRead(buttonON)== LOW)
{
delay(300), digitalWrite(LED1, HIGH);
delay(50), digitalWrite(LED2, HIGH);
delay(50), digitalWrite(LED3, HIGH);
delay(50), digitalWrite(LED4, HIGH);
delay(50), digitalWrite(LED5, HIGH);
delay(300), digitalWrite(LED1, LOW);
delay(100), digitalWrite(LED2, LOW);
delay(100), digitalWrite(LED3, LOW);
delay(100), digitalWrite(LED4, LOW);
delay(100), digitalWrite(LED5, LOW);
}
if (digitalRead(buttonOFF)== LOW)
{
digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW);
digitalWrite(LED3, LOW);
digitalWrite(LED4, LOW);
digitalWrite(LED5, LOW);
}
}
P.S. if anyone has other general tips I would really apreciate them


