Arduino traffic light with a pedestrian button
Open in the lab ▸Make my own copy
A crossing light as a state machine on an Arduino Uno: cars green until someone presses the button, then yellow, red with the walk light, a flashing walk light and green again. No delay() anywhere: the sketch remembers when each state began with millis(), so it watches the button the whole time and the cars always get at least 5 s of green. Open it and press Run: the sketch is inside the board (click the board, then Code). Every part, pin and resistor matches what you would build on a real breadboard; the guided build of the same name has the test sheet and hidden faults.
What is on the bench
14 parts, 19 wires, with a sketch (the program runs in the lab). Boards: Arduino Uno R3.
| Resistor | 5 |
|---|---|
| LED | 5 |
| Arduino Uno R3 | 1 |
| USB charger / port | 1 |
| Push button | 1 |
Put it on your page
The project runs live inside the frame: readers can press buttons, turn knobs and read the meters.
<iframe src="https://zencircuitlab.com/embed/zclctraffic" width="100%" height="560" style="border:1px solid #2f363a;border-radius:10px" loading="lazy" title="Arduino traffic light with a pedestrian button on Zen Circuit Lab"></iframe>
Link
https://zencircuitlab.com/p/zclctraffic
Published by its author under the lab's community terms: it may be opened, copied and changed by anyone. Simulation results are for learning; check a real build against the parts' datasheets.