Arduino Traffic Light Simulator

Techno Odisha

Project Description:

Simulate a traffic light using Arduino and LEDs! This project is so cool to watch and easy to do!

This simple little project uses Arduino and other LEDs to replicate the traffic light. It uses the code as an internal timer and continues to work until you cut out the Arduino power supply.

Using Materials

  • Arduino UNO
  • Breadboard (generic)
  • Jumper wires (generic) Male/Male required
  • LED (generic) You will need red, green, and blue lights
  • Arduino USB 2.0 data Cable (Mfr 25frf52 100r sml)
  • Resistor 100 ohm (Brown, Black, Brown)
  • APPS AND ONLINE SERVICES (Ide web, Arduino IDE

Schematic Diagram


Program Code

// variables int GREEN = 2; int YELLOW = 3; int RED = 4; int DELAY_GREEN = 5000; int DELAY_YELLOW = 2000; int DELAY_RED = 5000; // basic functions void setup() { pinMode(GREEN, OUTPUT); pinMode(YELLOW, OUTPUT); pinMode(RED, OUTPUT); } void loop() { green_light(); delay(DELAY_GREEN); yellow_light(); delay(DELAY_YELLOW); red_light(); delay(DELAY_RED); } void green_light() { digitalWrite(GREEN, HIGH); digitalWrite(YELLOW, LOW); digitalWrite(RED, LOW); } void yellow_light() { digitalWrite(GREEN, LOW); digitalWrite(YELLOW, HIGH); digitalWrite(RED, LOW); } void red_light() { digitalWrite(GREEN, LOW); digitalWrite(YELLOW, LOW); digitalWrite(RED, HIGH); }

*

Post a Comment (0)
Previous Post Next Post