Advaith Jagathesan
Published © GPL3+

The TrafficLight

The TrafficLight is a project that has Arduino-powered LEDs Blinking like a traffic light.

EasyShowcase (no instructions)12,569
The TrafficLight

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
Other boards can also be used, information in "About this project" under "Board Requirements"
×1
5 mm LED: Red
5 mm LED: Red
×8
5 mm LED: Yellow
5 mm LED: Yellow
×8
5 mm LED: Green
5 mm LED: Green
×8
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
SparkFun Rectifier Diode
Recommended, jumper wires could be used
×7
USB-A to B Cable
USB-A to B Cable
For controlling Arduino
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Software apps and online services

Arduino IDE
Arduino IDE
Arduino Web Editor
Arduino Web Editor
Fritzing

Story

Read more

Schematics

Mini Auto V9 Image

Image for the main latest version of The TrafficLight with an Arduino UNO. Alternate versions and older versions in GitHub repo.
Trafficlight%20mini%20auto%20v9%20make1

Fritzing File

Fritzing FZZ file with Breadboard diagram, Schematic, PCB, and Code. Download Fritzing above (under Apps and Online Services). Older versions in GitHub repo.

On Fritzing.org

The TrafficLight on Fritzing.org

Code

TrafficLight Mini Auto V9 Code

Arduino
Arduino Main Code for the latest version of The TrafficLight. Older versions and alternate versions in GitHub repo.
int emergency = 0;
void setup() {
  //sets up pins 3,4,5 as outputs
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(13, OUTPUT); //set up pin13LED as output
  pinMode(2, INPUT); //set up emergency switch as input
}

void loop() {
  emergency = digitalRead(2);
  if (emergency == LOW) {
   // do RED for 10sec, green for 10sec, and yellow for 3sec.
digitalWrite(13, LOW);
digitalWrite(3 , HIGH);
delay(10000);
digitalWrite(13, HIGH);
digitalWrite(3 ,LOW);
digitalWrite(5 ,HIGH);
delay(10000);
digitalWrite(5 ,LOW);
digitalWrite(4 ,HIGH);
delay(3000);
digitalWrite(4 , LOW);
  }
    else{
   digitalWrite(3, HIGH);
    digitalWrite(13, LOW);
    delay(1000);
    digitalWrite(3, LOW);
    digitalWrite(13, HIGH);
    delay(1000);
}
}
/* Notes:
Press the RESET button on your board to restart the circuit, putting it back on RED.
To go into Emergency Mode: Hold the Emergency Button and press RESET.
*/

Github repo

Arduino Create

Main Files in Arduino Create for the latest version. Alternate versions and older versions in GitHub repo.

Credits

Advaith Jagathesan

Advaith Jagathesan

1 project • 2 followers

Comments