int leds[] = {2, 3, 4, 5, 6}; // the LED pins for each LED
void setup() // to arrange the and set up the simulator for each LED
{
for (int i = 0; i < 5; i++) // sets all of the LED pins with "i" so that the simulator reads all LEDs
{
pinMode(leds[i], OUTPUT); //uses "i" to show for all LEDs
}
}
void loop() // where the action of ghe LEDs is arranged and processed
{
for (int repeat = 0; repeat < 3; repeat++) // To repeat the sequence 3 times
{
for (int i = 0; i < 5; i++) //sets all of the LED pins with "i" so that the simulator reads all LEDs
{
digitalWrite(leds[i], HIGH); // Turns the LEDs on one at a time
delay(500); // delays the simualtion 500 ms
digitalWrite(leds[i], LOW); // would optionally turn the LED off
}
delay(1000); //This turns the LEDs off for 1 second (1000ms)
}
delay(2000); //This delays the sim for 2 seconds once 3 sequences have been completed
}