// Define the pins for the LEDs
const int redPin = 2;
const int greenPin = 4;
const int yellowPin = 6;
const int orangePin = 8;
const int violetPin = 10;
void setup() {
// Set the LED pins as output
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(orangePin, OUTPUT);
pinMode(violetPin, OUTPUT);
}
void loop() {
// Chase in one direction
for (int i = 0; i < 5; i++) {
digitalWrite(i*2 + 2, HIGH); // Turn on the LED
delay(100); // Wait for 100ms
digitalWrite(i*2 + 2, LOW); // Turn off the LED
}
// Chase in the other direction
for (int i = 4; i >= 0; i--) {
digitalWrite(i*2 + 2, HIGH); // Turn on the LED
delay(100); // Wait for 100ms
digitalWrite(i*2 + 2, LOW); // Turn off the LED
}
}