const int ledPins[] = {12, 14, 27, 26, 25, 33}; // Pins connected to LEDs
const int potPin = 34; // Pin connected to potentiometer
void setup() {
for (int i = 0; i < 6; i++) {
pinMode(ledPins[i], OUTPUT);
}
}
void loop() {
// Read potentiometer value and use it to determine delay time
int potValue = analogRead(potPin);
float delayTime; // Delay time in seconds
// Map the potentiometer value to delay time
if (potValue <= 1023) {
delayTime = map(potValue, 0, 1023, 100, 250) / 1000.0; // 0.10 to 0.25 seconds
} else if (potValue <= 2046) {
delayTime = map(potValue, 1024, 2046, 250, 500) / 1000.0; // 0.25 to 0.50 seconds
} else if (potValue <= 3070) {
delayTime = map(potValue, 2047, 3070, 500, 750) / 1000.0; // 0.50 to 0.75 seconds
} else if (potValue <= 4095) {
delayTime = map(potValue, 3071, 4095, 750, 1500) / 1000.0; // 0.75 to 1.50 seconds
}
// Light chaser effect
for (int i = 0; i < 6; i++) {
digitalWrite(ledPins[i], HIGH); // Turn LED on
delay(delayTime * 1000); // Convert seconds to milliseconds
digitalWrite(ledPins[i], LOW); // Turn LED off
}
}