This is a simple Traffic signal project.
The sequence of the traffic signal is red, red and amber (yellow) together, green, amber, and then back to red.
As a bonus, if we hold the button down, the lights will change in sequence by themselves with a delay between each step. I've kept the delay to 1-second, you can change it to 2, 3, 5, etc. seconds.
Steps:1) First connect the 5v and GND of Arduino UNO to breadboard.
2) Connect the LED's to breadboard. Connect the ground terminal (shorter pin of LED) to ground of UNO. You can either connect all the cathode (ground) separately or you can connect them with each other using single strand wires and then connect a common ground terminal. For anode, connect a 220 ohm resistor with the anodes and then connect them to Arduino.
- RED-pin 2
- YELLOW-pin 3
- GREEN-pin 4
3) Connect the button with 1k ohm resistor and then connect it to ground. Connect the other terminal with pin 5 of Arduino.
4) Now write and upload the code to UNO. The LED's should start to blink. Pressing the button will allow it to jump to the next step. Holding the button continuously will allow the LED to remain in the same state.
Comments