//2024.3.6

#define Green 12   //定义绿色灯引脚 Define the green light pin
#define Yellow 11  //定义黄色灯引脚 Define the yellow light pin
#define red 10     //定义绿色灯引脚 Define the green 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

  //绿灯每500毫秒闪烁一次 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);

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

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

  //红灯每500毫秒闪烁一次 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);
}
