int ledPin[] = {13, 12, 11,10};
int ledDelay[4]={8000, 4000,2000, 1000};
// declare other required variables
unsigned long lastToggle[4] = {0, 0, 0, 0};
const unsigned long intervals[4] = {1000, 2000, 4000, 8000};
void setup() {
for(int i=0;i<4;i++){
// initialize lastChangeTimes
pinMode(ledPin[i], OUTPUT);
// set pin mode for ledPins
}
}
void loop() {
unsigned long currentMillis = millis();
for (int i = 0; i < 4; i++) {
if (currentMillis - lastToggle[i] >= intervals[i]) {
digitalWrite(ledPin[i], !digitalRead(ledPin[i]));
lastToggle[i] = currentMillis;
}
}
}