// Pin assignments
const int redPin = 10;
const int yellowPin = 9;
const int greenPin = 8;
void setup() {
// Initialize the digital pins as outputs
pinMode(redPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(greenPin, OUTPUT);
}
void loop() {
// Red light on
digitalWrite(redPin, HIGH);
delay(2000); // Wait for 2 seconds
digitalWrite(redPin, LOW);
digitalWrite(yellowPin, HIGH);
delay(2000); // Wait for 2 seconds
digitalWrite(yellowPin, LOW);
// Green light on
digitalWrite(greenPin, HIGH);
delay(2000); // Wait for 2 seconds
digitalWrite(greenPin, LOW);
// Yellow light on
// Optional gap between cycles
delay(2000); // Wait for 2 seconds before the next cycle
}