// Define LED pins
const int redPin = 13;
const int yellowPin = 12;
const int greenPin = 11;
// Timing constants (in milliseconds)
const int redDuration = 5000; // 5 seconds
const int yellowDuration = 2000; // 2 seconds
const int greenDuration = 5000; // 5 seconds
void setup() {
// Initialize LED pins as output
pinMode(redPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(greenPin, OUTPUT);
}
void loop() {
// Turn on red light
digitalWrite(redPin, HIGH);
delay(redDuration);
// Turn off red light and turn on green light
digitalWrite(redPin, LOW);
digitalWrite(greenPin, HIGH);
delay(greenDuration);
// Turn off green light and turn on yellow light
digitalWrite(greenPin, LOW);
digitalWrite(yellowPin, HIGH);
delay(yellowDuration);
// Turn off yellow light
digitalWrite(yellowPin, LOW);
}