The Best DIY STEM Tutorials and Projects

OVERVIEW
In this project, we’ll build a mini traffic light using Arduino and LEDs! Just like real traffic lights, our setup will cycle through red, yellow, and green signals to control the “traffic.” This is a fun way to learn about timing, sequencing, and how Arduino controls multiple outputs. Let’s bring the streets to life with code! 🚗💡
You can follow this video and the instructions below.
Video
Components Required
Here is a list of Components that we will need to make this Project.

Sr # | Item Name | Quantity |
---|---|---|
1 | Arduino Uno | 1 |
2 | Breadboard | 1 |
3 | Resistors | 1 |
4 | M-F Jumper wires | 7 |
5 | LEDs | 3 |
6 | Arduino cable | 1 |
Wiring Diagram
Here is a Complete Wiring Diagram along with Instructions for this Project

Program / Code
Code is Explained in the Comments of the Code
const int redPin = 8; const int yellowPin = 10; const int greenPin = 12; void setup() { pinMode(redPin, OUTPUT); pinMode(yellowPin, OUTPUT); pinMode(greenPin, OUTPUT); } void loop() { // Red light for 5 seconds digitalWrite(redPin, HIGH); digitalWrite(yellowPin, LOW); digitalWrite(greenPin, LOW); delay(5000); // Yellow light for 2 seconds (transition from red to green) digitalWrite(redPin, LOW); digitalWrite(yellowPin, HIGH); digitalWrite(greenPin, LOW); delay(2000); // Green light for 5 seconds digitalWrite(redPin, LOW); digitalWrite(yellowPin, LOW); digitalWrite(greenPin, HIGH); delay(5000); }
Thank you so much for going through our tutorial, we hope it was easy to follow and you enjoyed it, please share your feedback and pictures of the project (if you have made it) in the comments below .!