Make a traffic light system using Arduino Unoecx.images-amazon.com/images/I/A1+bgpcdOcS.pdf ·...

7

Transcript of Make a traffic light system using Arduino Unoecx.images-amazon.com/images/I/A1+bgpcdOcS.pdf ·...

Make a traffic light system using Arduino Uno

1

Specifications

Power Supply – 5V (For whole project)

Hardware Required

• Arduino uno with Usb cable – 1

• Single Stand Wire – 1

• 400 point breadboard – 1

• Led (Red,Green,yellow) – 1

• Resistor 220 ohm – 3

• Jumper wires (male to male)

Must use the Resistor for limiting the value of current applied on LED

2

Software Required:

Arduino IDE (Programmable Platform for Arduino)

• Pin Description:

How to check the positive and negative terminal of the Led?

• The longer leg is cathode(Negative) and the shorter leg is anode

(positive)

• In the bulb , bigger flag is negative and shorter flag is positive.

• On the bulb surface, the flat surface is negative and rounded

surface is positive

3

4

Circuit Connection

• connect all the negative of the leds then connect to the ground pin of Arduino uno

• Positive of green Led to Arduino’s digital pin 8 via 220 ohm resistor adding on positive

terminal of led.

• Positive of Yellow Led to Arduino’s digital pin 9 via 220 ohm resistor adding on positive

terminal of led.

• Positive of Red Led to Arduino’s digital pin 10 via 220 ohm resistor adding on positive

terminal of led.

4

Code

Modified by

TECHNICAL TEAM,REES52

int greenled = 8; //Led's and pins

int yellowled = 9;

int redled = 10;

void setup()

{

pinMode(greenled, OUTPUT); //Pinmodes of the leds

pinMode(yellowled, OUTPUT);

pinMode(redled, OUTPUT);

}

void loop()

{

digitalWrite(greenled, HIGH); //Green on for 5 seconds

delay(5000);

digitalWrite(greenled, LOW); //Green off, yellow on for 2 seconds

digitalWrite(yellowled, HIGH);

delay(2000);

digitalWrite(yellowled, LOW); //yellow off, red on for 5 seconds

digitalWrite(redled, HIGH);

delay(5000);

digitalWrite(yellowled, HIGH); //Yellow and red on for 2 seconds

delay(2000);

digitalWrite(redled, LOW); //Red and Yellow off

digitalWrite(yellowled, LOW);

}

5