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 control a traffic light system using an Arduino UNO microcontroller. The system operates a simple traffic light sequence with three lights: green, yellow, and red. The sequence starts with the green light on for 5 seconds, followed by the yellow light for 2 seconds, and then the red light for 5 seconds. This cycle repeats indefinitely.

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 UNO D3 pin connected to Traffic Light Green
const int yellowPin = 2; // Arduino UNO D2 pin connected to Traffic Light Yellow
const int redPin = 1;    // Arduino UNO D1 pin connected to Traffic Light Red

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

File Name: sketch.ino

This code is written for the Arduino UNO microcontroller to control the traffic light sequence. The setup() function initializes the pins connected to the traffic light LEDs as outputs. The loop() function then controls the sequence of the lights, turning each LED on and off for the specified duration.