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 circuit that is designed to operate a three-color traffic light system. The circuit uses an Arduino UNO microcontroller to cycle through green, yellow, and red LEDs, which simulate a traffic light. The sequence of operation is as follows:

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
 * This sequence repeats indefinitely.
 */

// Pin definitions
const int greenPin = 3; // Arduino pin connected to the green LED of the Traffic Light
const int yellowPin = 2; // Arduino pin connected to the yellow LED of the Traffic Light
const int redPin = 1; // Arduino pin connected to the red LED of the Traffic Light

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 enters an infinite loop where it turns each LED on and off in the sequence described above. The delay() function is used to keep each LED on for the specified duration.