void setup()
{
int led1 = 7, led2 = 8, led3 = 9; //signals to the simularotr where each LED is connected to each pin
pinMode(led1, OUTPUT); //sends the signal for LED1
pinMode(led2, OUTPUT); //sends the signal for LED2
pinMode(led3, OUTPUT); //sends the signal for LED3
}
void loop()
{
int led1 = 7, led2 = 8, led3 = 9;
for (int i = 0; i < 3; i++) // To repeat the sequence 3 times
{
digitalWrite(led1, HIGH); //To turn the LEDs on one at the same time. Here is the 1st one.
digitalWrite(led2, HIGH); //2nd one
digitalWrite(led3, HIGH); //3rd one
delay(500); // delays the simualtion 500 ms or half a second
digitalWrite(led1, LOW); //To turn the LEDs off one at the same time. Here is the 1st one.
digitalWrite(led2, LOW); //2nd one
digitalWrite(led3, LOW); //3rd one
delay(500); //This turns the LEDs off for 1/2 a second and repeats 2 more times
}
for (int i = 0; i < 2; i++) //this needed so the simulator can prcoess the next set of commands
{
digitalWrite(led1, HIGH); //To turn the LED on by itself. Here is the 1st one.
delay(300); // separates the blinks by 300 ms
digitalWrite(led1, LOW); //To turn the LED off by itself. Here is the 1st one.
delay(300); // separates the blinks by 300 ms
}
for (int i = 0; i < 2; i++) //this needed so the simulator can prcoess the next set of commands
{
digitalWrite(led2, HIGH); //To turn the LED on by itself. Here is the 2nd one.
delay(300); // separates the blinks by 300 ms
digitalWrite(led2, LOW); //To turn the LED off by itself. Here is the 2nd one.
delay(300); // separates the blinks by 300 ms
}
for (int i = 0; i < 2; i++) //this needed so the simulator can prcoess the next set of commands
{
digitalWrite(led3, HIGH); //To turn the LED on by itself. Here is the 3rd one.
delay(300); // separates the blinks by 300 ms
digitalWrite(led3, LOW); //To turn the LED off by itself. Here is the 3rd one.
delay(300); // separates the blinks by 300 ms
}
}