const int buttonPin = 7; // Pin for the push button
const int ledPins[] = {2, 3, 4, 5, 6}; // Pins for the LEDs
int buttonState = 0; // Variable for reading the push button status
int currentLED = 0; // Variable to track the current LED
void setup() {
pinMode(buttonPin, INPUT);
for (int i = 0; i < 1; i++) {
pinMode(ledPins[i], OUTPUT);
}
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(ledPins[currentLED], HIGH);
delay(500); // Wait for 500 milliseconds
digitalWrite(ledPins[currentLED], LOW);
currentLED = (currentLED + 1) % 5; // Move to the next LED
while (digitalRead(buttonPin) == HIGH); // Wait for button release
}
}