Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Rahul Khanna
Published © GPL3+

Build Your Own Traffic Light Controller with Arduino Uno R4

We will be building a traffic light controller using Arduino Uno R4 Minima and Arduino Cloud IDE.

BeginnerFull instructions provided1 hour374
Build Your Own Traffic Light Controller with Arduino Uno R4

Things used in this project

Hardware components

UNO R4 Minima
Arduino UNO R4 Minima
×1
Signal Indicator Accessory, EZ-LIGHT Traffic Lights
Signal Indicator Accessory, EZ-LIGHT Traffic Lights
×1

Software apps and online services

Arduino IoT Cloud
Arduino IoT Cloud

Story

Read more

Schematics

Conenctions

Code

Arduino Code

Arduino
int red_led = 13;
int yellow_led = 12;
int green_led = 11;

void setup() {
  pinMode(red_led, OUTPUT);
  pinMode(yellow_led, OUTPUT);
  pinMode(green_led, OUTPUT);

  digitalWrite(red_led, LOW);
  digitalWrite(yellow_led, LOW);
  digitalWrite(green_led, LOW);
}

void loop() {
  digitalWrite(red_led, HIGH);
  delay(10000);
  digitalWrite(red_led, LOW);

  digitalWrite(yellow_led, HIGH);
  delay(3000);
  digitalWrite(yellow_led, LOW);

  digitalWrite(green_led, HIGH);
  delay(10000);
  digitalWrite(green_led, LOW);

  digitalWrite(yellow_led, HIGH);
  delay(5000);
  digitalWrite(yellow_led, LOW);
}

Credits

Rahul Khanna
48 projects • 226 followers
Research Enthusiast - Computer Vision, Machine Intelligence | Embedded System | Robotics | IoT | Intel® Edge AI Scholar

Comments