In this tutorial we will making a traffic lights that will change from green to red via amber, after a set of time using the 4 state system. This project could be used on model railway, model road or model car, make a set of working traffic light for your DIY scaled town or building a road.
Electronic parts required.
- Arduino UNO/MEGA/NANO/PRO
- 3x LED ( Red, Green, Yellow)
- 3x 220 Ohms Resistor
- Jumper Wires
- Solder-less Breadboard
Wiring the LED to Arduino
As you can see below we have to connect 3 LED’s with the Anode of each one going to digital Pings 8,9 and 10, via a 220 Ohms resistor on each LED. Jumper wires a place from ground to the ground rail at the top of the breadboard and a ground wire goes from the cathode led of each LED going to the common ground rail.
Sketch Code
[crayon-66d3cc62407db986644231/]
Making a LED Traffic Light with Arduino