// Define the number of LEDs
const int numLEDs = 10;
// Define the pins for the LEDs
int ledPins[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
void setup() {
// Initialize the LED pins as outputs
for (int i = 0; i < numLEDs; i++) {
pinMode(ledPins[i], OUTPUT);
}
}
void loop() {
// Turn on each LED in sequence
for (int i = 0; i < numLEDs; i++) {
digitalWrite(ledPins[i], HIGH);
delay(100); // Adjust the delay as needed
digitalWrite(ledPins[i], LOW);
}
// Turn off each LED in reverse sequence
for (int i = numLEDs - 1; i >= 0; i--) {
digitalWrite(ledPins[i], HIGH);
delay(100); // Adjust the delay as needed
digitalWrite(ledPins[i], LOW);
}
}