Traffic_Light_Control_System_Using_Arduino
Traffic_Light_Control_System_Using_Arduino
AIM
To design and implement a traffic light control system using Arduino that simulates the
REQUIRED ITEMS
- Red LED
- Yellow LED
- Green LED
- 3 × 220Ohm resistors
- Breadboard
- Jumper wires
- USB cable
ARDUINO ALGORITHM
BLOCK DIAGRAM
Refer to the schematic showing the relationship between the Arduino and the three LEDs
(Red, Yellow, Green) each connected through resistors to digital output pins.
FLOWCHART
Start -> Set all LED pins as OUTPUT -> Turn ON Green LED -> Wait 5 sec -> Turn OFF Green,
Turn ON Yellow -> Wait 2 sec -> Turn OFF Yellow, Turn ON Red -> Wait 5 sec -> Turn OFF Red -
> Repeat
PROCEDURE
1. Connect the Red, Yellow, and Green LEDs to Arduino digital pins through 220Ohm resistors.
3. Open Arduino IDE and connect the Arduino board via USB.
4. Write or paste the traffic light control code into the IDE.
CODE
void setup()
{ pinMode(redPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(greenPin, OUTPUT);
Traffic Light Control System using Arduino
void loop()
{ digitalWrite(greenPin, HIGH);
delay(5000);
digitalWrite(greenPin, LOW);
digitalWrite(yellowPin, HIGH);
delay(2000);
digitalWrite(yellowPin, LOW);
digitalWrite(redPin, HIGH);
delay(5000);
digitalWrite(redPin, LOW);
}
RESULT
The traffic light control system operates successfully. The green LED turns on for 5 seconds,
followed by the yellow LED for 2 seconds, and the red LED for 5 seconds. This sequence repeats