Arduino Traffic Light LED on Breadboard

 












Objective:

Set up a traffic light LED automated system.

Arrange the resisters in series.

Code:

void setup() {
  // put your setup code here, to run once:

  // GREEN PIN
  pinMode(10, OUTPUT);

  // YELLOW PIN
  pinMode(7, OUTPUT);

  // RED PIN
  pinMode(3, OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:

  // GREEN LED
  digitalWrite(10, HIGH);
  delay(10000);
  digitalWrite(10, LOW);
  delay(1000);

  // YELLOW LED
  digitalWrite(7, HIGH);
  delay(1000);
  digitalWrite(7, LOW);
  delay(1000);

  // RED LED
  digitalWrite(3, HIGH);
  delay(10000);
  digitalWrite(3, LOW);
  delay(1000);

}

Video:

The presentation video is in the link below.

Popular posts from this blog

Install WSL & Code C in VS Code on Windows 10/11

Arduino LED