//int timer = 100; // The higher the number, the slower the timing.
int ledPin[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,}; // an array of pin numbers to which LEDs are attached
int pinCount = 11; // the number of pins (i.e. the length of the array)
int timer = 1000; // The higher the number, the slower the timing.
int LedPins[] = { 17, 14, 15, 16 }; // 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 analogpins = 0; analogpins < 4; analogpins++)
{
pinMode(LedPins[analogpins], OUTPUT);
}
}
void loop() {
// loop from the lowest pin to the highest:
for (int analogpins = 0; analogpins < 4; analogpins++)
{
// turn the pin on:
digitalWrite(LedPins[analogpins], HIGH);
delay(timer);
// turn the pin off:
digitalWrite(LedPins[analogpins], LOW);
}
}