Arduino LED Traffic Light

by Henry Li00 in Circuits > LEDs

146 Views, 0 Favorites, 0 Comments

Arduino LED Traffic Light

FC37C69F-3383-40E5-9E9B-21C285726ED6.jpeg
Arduino traffic light

Supplies

What you will need:
•Wire x4
•Circuit board x1
•Arduino LEONARDO
•LED lights (one red, green and yellow LED light bulb) x1

Circuit Connect

93DFC500-9844-4D37-80C2-DAD0891D3C94.jpeg

According to the picture,connect the LED lights and wires to the circuit board.

Uploading the Code and Finalizing

After finishing circuit, you can paste my code into your Arduino IDE, connect the board with the USB transmissions, than upload the code.
That it!

You can change the delay time or adding some more things if you want.

Video:

Here is the code:

—————————————————————————
int redled = 3 ;
int yellowled = 5 ;
int greenled = 7 ;
void setup()
{
pinMode(redled, OUTPUT) ;
pinMode(yellowled, OUTPUT) ;
pinMode(greenled, OUTPUT) ;
}
void loop()
{
digitalWrite(redled, HIGH) ;
delay(5000) ;
digitalWrite(redled, LOW) ;
digitalWrite(yellowled, HIGH) ;
delay(2000) ;
digitalWrite(yellowled, LOW) ;
digitalWrite(greenled, HIGH) ;
delay(5000) ;
digitalWrite(greenled, LOW) ;
}

Downloads