Introduction To Traffic Light PDF
Introduction To Traffic Light PDF
Light
COMPONENTS
1. EVOED BOARD
FEATURES
Microcontroller: The heart of an Arduino board is its microcontroller, which executes the program instructions.
Microcontrollers used in Arduino boards the ATmega328 .
Digital I/O Pins: These pins can be used to read digital signals (e.g., from a button) or send digital signals (e.g., to an
LED).
Analog Pins: These pins are used to read analog signals (e.g., from a potentiometer).
Built-in LED: Most Arduino boards have a built-in LED connected to a specific pin (e.g., pin 13 on the Arduino Uno),
Reset Button: A physical button that can be pressed to restart the program running on the board.
This pin provides a 5-volt supply from the regulator on the board. Most Arduino boards, like the Arduino Uno, have a
5V pin that you can use to power external components like sensors, LEDs, and modules.
When the board is powered via USB, the 5V pin provides a stable 5V.
The GND pins on an Arduino board are the reference point for the voltage levels and are used to complete the
electrical circuit. All components and modules connected to the Arduino need a common ground to operate
correctly.
The ground pins are connected internally, so you can use any of the GND pins to connect your circuit's ground.
RESISTOR & LEDs
RESISTOR LEDs
A resistor is a two-terminal electrical component that Red, yellow, and green LEDs to represent the traffic
limit the current to the LEDs and protect the board's light signals.
pins.
WORKING
1.Red Light: When the traffic light is red, it indicates that vehicles must come to a complete stop. Vehicles should
not enter the intersection or proceed further until the light turns green.
2.Yellow Light: The yellow or amber light comes between the red and green lights. It serves as a warning that the
light is about to turn red.
3.Green Light: The green light signals vehicles that it is safe to proceed. It allows traffic from the direction facing
the green light to move through the intersection.
PROGRAM:
void setup()
{
// Initialize the LED pins as outputs
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}
void loop()
{
digitalWrite(11, HIGH); // turn on led
delay(5000); // Wait for 5 seconds
digitalWrite(11, LOW); // turn off led
delay(5000);
digitalWrite(12, HIGH);
delay(2000); // Wait for 2 seconds
digitalWrite(12, LOW);
delay(2000);
digitalWrite(13, HIGH);
delay(5000); // Wait for 5 seconds
digitalWrite(13, LOW);
delay(5000);
}