Take your DIY skills to the next level with this amazing Arduino Uno project! In this video, we'll show you how to bring traffic lights to life using the popular microcontroller board. From setting up the circuit to writing the code, we'll guide you through every step of the process. Whether you're a beginner or an experienced maker, you'll love this project that combines electronics, programming, and creativity. So, let's get started and make those traffic lights shine!
Create a traffic light system using an Arduino Uno and LEDs, simulating a real-world traffic signal with Red, Yellow, and Green LEDs.
1. Red LED:
2. Yellow LED:
3. Green LED:
// Define LED pins
const int redLED = 13;
const int yellowLED = 12;
const int greenLED = 11;
void setup() {
// Set LED pins as outputs
pinMode(redLED, OUTPUT);
pinMode(yellowLED, OUTPUT);
pinMode(greenLED, OUTPUT);
}
void loop() {
// Red light ON for 5 seconds
digitalWrite(redLED, HIGH);
digitalWrite(yellowLED, LOW);
digitalWrite(greenLED, LOW);
delay(5000);
// Yellow light ON for 2 seconds
digitalWrite(redLED, LOW);
digitalWrite(yellowLED, HIGH);
digitalWrite(greenLED, LOW);
delay(2000);
// Green light ON for 5 seconds
digitalWrite(redLED, LOW);
digitalWrite(yellowLED, LOW);
digitalWrite(greenLED, HIGH);
delay(5000);
}
Upload the Code:
Power the Circuit:
Observe the Traffic Light Sequence: