#define Green 13   // Define the green light pin
#define Yellow 11  // Define the yellow light pin
#define red 10     // Define the red light pin

void setup() {
  // Define the pin as the output working mode
  pinMode(Green, OUTPUT); 
  pinMode(Yellow, OUTPUT);
  pinMode(red, OUTPUT);   
}

void loop() {
  digitalWrite(Green, HIGH);  // Turn on the green light
  digitalWrite(Yellow, LOW);  // Put out the yellow light
  digitalWrite(red, LOW);     // Turn off the red light
  delay(5000);                // Turn on the green light for five seconds

  // The green light flashes every 500 milliseconds
  digitalWrite(Green, HIGH);
  delay(500);
  digitalWrite(Green, LOW);
  delay(500);
  digitalWrite(Green, HIGH);
  delay(500);
  digitalWrite(Green, LOW);
  delay(500);
  digitalWrite(Green, HIGH);
  delay(500);

  // The yellow light is on for 1 second
  digitalWrite(Green, LOW);
  digitalWrite(Yellow, HIGH);
  digitalWrite(red, LOW);
  delay(1200);

  // The red light stays on for 5 seconds
  digitalWrite(Green, LOW);
  digitalWrite(Yellow, LOW);
  digitalWrite(red, HIGH);
  delay(5000);

  // The red light flashes every 500 milliseconds
  digitalWrite(red, HIGH);
  delay(500);
  digitalWrite(red, LOW);
  delay(500);
  digitalWrite(red, HIGH);
  delay(500);
  digitalWrite(red, LOW);
  delay(500);
  digitalWrite(red, HIGH);
  delay(500);
}
