Project showcase
The TrafficLight

The TrafficLight © GPL3+

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

  • 13,210 views
  • 1 comment
  • 22 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
Other boards can also be used, information in "About this project" under "Board Requirements"
×1
Kingbright wp7113srd d image
5 mm LED: Red
×8
Led technology l03r5000q1 image
5 mm LED: Yellow
×8
Kingbright wp7113sgd
5 mm LED: Green
×8
11026 02
Jumper wires (generic)
×1
12002 04
Breadboard (generic)
×1
SparkFun Rectifier Diode
Recommended, jumper wires could be used
×7
Adafruit industries ada62 image 75px
USB-A to B Cable
For controlling Arduino
×1
Mfr 25frf52 10k sml
Resistor 10k ohm
×1

Apps and online services

About this project

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

Go to the repository on GitHub

Image: TrafficLight Mini Auto V9 with Arduino Uno Rev3

To go  into Emergency Mode:

Hold the Emergency Button and press RESET

All Materials Available in the Arduino Starter Kit (International Store/Store USA)

Board Requirements:

Any Arduino board with 2,3,4,5 digital ports an on-board LED (recommended), 5V port, RESET button (recommended) and GROUND port (International Store/Store USA)

Or:

An Intel Galileo

An Intel Galileo Gen2 (International Store/Store USA)

An Intel Edison with Arduino Kit (International Store)

Or any other Arduino-Compatible Board!

WARNING TO SHIELD USERS: Some shields will block some of the required ports, making the TrafficLight not work properly. We are working on alternate versions and will post more information soon.

The affecting shields are: Arduino GSM Shield, Arduino Ethernet Shield, Arduino WiFi Shield, Arduino Wireless SD Shield.

The Alternate Versions for the Shields are available in the Alternate Versions Folder (under Resources)

NOTE TO ETHERNET AND GSM SHIELD USERS: The Pin 13 On-board LED is not available while these Shields are in use.

You Will Also Need:

8 red, 8 yellow, 8 green LEDS

Assorted Jumper Wires

Breadboard

Diodes (recommended)

USB Cable (for controlling Arduino)

Resources:

Code (.ino)

Fritzing File (with Code and Image)

Image

Alternate Versions

Resources Archive

Code

To upload the code to the Arduino, you will need the Arduino IDE or Fritzing

Code

TrafficLight Mini Auto V9 CodeArduino
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.
*/
Arduino Create
Main Files in Arduino Create for the latest version. Alternate versions and older versions in GitHub repo.

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.
TrafficLight%20Mini%20Auto%20V9%20Make1.fzz
On Fritzing.org
The TrafficLight on Fritzing.org

Comments

Similar projects you might like

PIR Automated Intelligent Zebra Crossing

Project showcase by Adersh B

  • 2,832 views
  • 1 comment
  • 8 respects

Simple Programmable Robotic Arm

Project showcase by Ryan Chan

  • 49,020 views
  • 63 comments
  • 145 respects

Multicolor Knight Rider with RGB PL9823 LED + Arduino UNO

Project tutorial by Giovanni Gentile

  • 4,628 views
  • 0 comments
  • 11 respects

Measure your reaction time

Project tutorial by Jayraj Desai

  • 29,240 views
  • 9 comments
  • 30 respects

Button: Arduino Basics

by Alex Glow

  • 11,362 views
  • 0 comments
  • 12 respects

3-Bit Binary Calculator Using Arduino Uno

Project showcase by 22warehamD

  • 3,240 views
  • 8 comments
  • 12 respects
Add projectSign up / Login