Arduino LED Traffic Light
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
•Wire x4
•Circuit board x1
•Arduino LEONARDO
•LED lights (one red, green and yellow LED light bulb) x1
Circuit Connect
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) ;
}