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 document describes a simple traffic light control system designed using an Arduino UNO microcontroller and a traffic light module with three LEDs (Green, Yellow, and Red). The system operates by cycling through the LEDs in a typical traffic light sequence: green light on for 5 seconds, followed by yellow light for 2 seconds, and then red light for 5 seconds. This sequence repeats indefinitely to simulate a traffic light control system.

Component List

Arduino UNO

Traffic Light

Wiring Details

Arduino UNO

Traffic Light

Documented Code

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

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

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

This code is responsible for controlling the traffic light sequence. It initializes the digital pins connected to the LEDs as outputs and then sets each LED to high in turn, with appropriate delays to simulate a traffic light.