Perhaps you can review some of the other posts that show you how to properly post code.
Ok now that I know how to post code lets continue.
I'm using just the array function right now.
int timer = 5000; // The higher the number, the slower the timing.
int ledPins[] = {
9, 10, 12, 11 }; // an array of pin numbers to which LEDs are attached
int pinCount = 4; // the number of pins (i.e. the length of the array)
void setup() {
// the array elements are numbered from 0 to (pinCount - 1).
// use a for loop to initialize each pin as an output:
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
pinMode(ledPins[thisPin], OUTPUT);
}
}
void loop() {
// loop from the lowest pin to the highest:
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
// turn the pin on:
digitalWrite(ledPins[thisPin], HIGH);
delay(timer);
// turn the pin off:
digitalWrite(ledPins[thisPin], LOW);
}
// loop from the highest pin to the lowest:
for (int thisPin = pinCount - 1; thisPin >= 0; thisPin--) {
// turn the pin on:
digitalWrite(ledPins[thisPin], HIGH);
delay(timer);
// turn the pin off:
digitalWrite(ledPins[thisPin], LOW);
}
}
I fixed the issue of some lights staying on longer than other by changing "for (int thisPin = pinCount - 1; thisPin >= 0; thisPin--)" to "for (int thisPin = pinCount - 2; thisPin > 0; thisPin--)"
Now I need to randomize the sequence