// Pin numbers for the LEDs
int greenLED = 8;
int yellowLED = 9;
int redLED = 10;
void setup() {
// Initialize the LED pins as outputs
pinMode(greenLED, OUTPUT);
pinMode(yellowLED, OUTPUT);
pinMode(redLED, OUTPUT);
}
void loop() {
// Green light for 6 seconds
digitalWrite(greenLED, HIGH);
delay(6000); // 6000 milliseconds is 6 seconds
digitalWrite(greenLED, LOW);
// Yellow light blinks for 2 seconds
int count;
for (count = 0; count < 4; count = count + 1) { // Blink yellow LED twice for a total of 2 seconds
digitalWrite(yellowLED, HIGH); // Turn on yellow LED
delay(250); // Keep it on for 250 milliseconds
digitalWrite(yellowLED, LOW); // Turn off yellow LED
delay(250); // Keep it off for 250 milliseconds
}
// Red light for 5 seconds
digitalWrite(redLED, HIGH);
delay(5000); // 5000 milliseconds is 5 seconds
digitalWrite(redLED, LOW);
// The loop() function will run these commands over and over again, creating a repeating sequence.
}