IOE1
IOE1
Theory:
The Arduino Uno is an open-source microcontroller board based on the Microchip ATmega328P
microcontroller and developed by Arduino.cc and initially released in 2010. The board is
equipped with sets of digital and analog input/output pins that may be interfaced to various
expansion boards and other circuits.
The Arduino boards also consists of on board voltage regulator and crystal oscillator. They also
consist of USB to serial adapter using which the Arduino board can be programmed using USB
connection.
A light-emitting diode is a semiconductor light source that emits light when current flows
through it. Electrons in the semiconductor recombine with electron holes, releasing energy in the
form of photons.
Components Required
You will need the following components −
• 1 × Breadboard
• 1 × Arduino Uno
• 3× LED (Red Green yellow)
• 1 × 100Ω Resistor
• 3 × Jumper
1. Arduino UNO 2. LED 4. Breadboard 5. Jump Wire
3. Resistor 100
ohm
Diagram:
Code:
int GREEN = 2;
int YELLOW = 3;
int RED = 4;
int DELAY_GREEN = 5000;
int DELAY_YELLOW = 2000;
int DELAY_RED = 5000;
void setup()
{
pinMode(GREEN, OUTPUT);
pinMode(YELLOW, OUTPUT);
pinMode(RED, OUTPUT);
}
void loop()
{
green_light();
delay(DELAY_GREEN);
yellow_light();
delay(DELAY_YELLOW);
red_light();
delay(DELAY_RED);
}
void green_light()
{
digitalWrite(GREEN, HIGH);
digitalWrite(YELLOW, LOW);
digitalWrite(RED, LOW);
}
void yellow_light()
{
digitalWrite(GREEN, LOW);
digitalWrite(YELLOW, HIGH);
digitalWrite(RED, LOW);
}
void red_light()
{
digitalWrite(GREEN, LOW);
digitalWrite(YELLOW, LOW);
digitalWrite(RED, HIGH);
}
Result:
You should see your each LED turn on and off like a Trafic Signal at some interval of time . If
the required output is not seen, make sure you have assembled the circuit correctly, and verified
and uploaded the code to your board.
CONCLUSION: Hence Learned and implemented Traffic light Pattern of led with the
help of Arduino uno board.