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 Circuit Documentation

Summary

This circuit is designed to simulate a traffic light system using an Arduino UNO microcontroller and a custom traffic light module. The system operates by sequentially illuminating green, yellow, and red LEDs to mimic the behavior of a standard traffic light. The green LED is activated for 5 seconds, followed by the yellow LED for 2 seconds, and finally, the red LED for 5 seconds. This cycle repeats indefinitely to demonstrate a simple traffic light control mechanism.

Component List

Arduino UNO

Traffic Light

Wiring Details

Arduino UNO

Traffic Light

Documented Code

/*
 * This Arduino sketch controls a traffic light system with three LEDs: green,
 * yellow, and red. The green LED stays on for 5 seconds, followed by the
 * yellow LED for 2 seconds, and then the red LED for 5 seconds. This cycle
 * repeats indefinitely.
 */

// Pin definitions
const int greenPin = 3;  // Arduino UNO D3 pin
const int yellowPin = 2; // Arduino UNO D2 pin
const int redPin = 1;    // Arduino UNO D1 pin

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);
}

Filename: sketch.ino

Description: The code is written for the Arduino UNO microcontroller. It initializes three digital pins as outputs to control the green, yellow, and red LEDs of the traffic light module. The loop() function turns on each LED in sequence with specified delays to create the traffic light effect.