Hackster will be offline on Monday, September 30 from 8pm to 10pm PDT to perform some scheduled maintenance.
Rahul Khanna D
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 hour362
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 D

Rahul Khanna D

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

Comments