Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Controlled Traffic Light System

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled Traffic Light System

Traffic Light Control System Documentation

Summary

The circuit described in this documentation is designed to control a traffic light system using an Arduino UNO microcontroller. The traffic light system consists of three LEDs (Green, Yellow, and Red) that simulate a traffic signal. The Arduino UNO is programmed to switch these LEDs on and off in a specific sequence to mimic the operation of a standard traffic light. The sequence is as follows:

This sequence repeats indefinitely to simulate a traffic light control system.

Component List

Arduino UNO

Traffic Light

Joystick Module

Wiring Details

Arduino UNO

Traffic Light

Joystick Module

Documented Code

/*
 * This Arduino sketch controls a traffic light system.
 * The traffic light has three LEDs: Green, Yellow, and Red.
 * The sequence is as follows:
 * - Green LED is on for 5 seconds
 * - Yellow LED is on for 2 seconds
 * - Red LED is on for 5 seconds
 * This sequence repeats indefinitely.
 */

// Pin definitions
const int greenPin = 3;
const int yellowPin = 2;
const int redPin = 1;

void setup() {
  // Initialize the digital pins as outputs
  pinMode(greenPin, OUTPUT);
  pinMode(yellowPin, OUTPUT);
  pinMode(redPin, OUTPUT);
}

void loop() {
  // Green LED on for 5 seconds
  digitalWrite(greenPin, HIGH);
  delay(5000);
  digitalWrite(greenPin, LOW);

  // Yellow LED on for 2 seconds
  digitalWrite(yellowPin, HIGH);
  delay(2000);
  digitalWrite(yellowPin, LOW);

  // Red LED on for 5 seconds
  digitalWrite(redPin, HIGH);
  delay(5000);
  digitalWrite(redPin, LOW);
}

The code provided is an Arduino sketch written in C++ for the Arduino IDE. It defines three pins connected to the respective LEDs of the traffic light and sets them as outputs in the setup() function. The loop() function then controls the state of each LED to create the traffic light sequence. The comments within the code provide additional context and explanation of the code's functionality.