Alternate LED Blink
In this project, you will learn how to make two LEDs blink alternately using an Arduino Uno. When one LED turns ON, the other turns OFF, creating a simple alternating light effect. This project is ideal for beginners learning Arduino programming, digital outputs, and basic circuit wiring.
Supplies
Quantity Component:
Arduino Uno 1
Breadboard 2
LEDs (Red & Green) 2
220Ω Resistors 2
Jumper Wires
USB Cable
Understanding the Project
The Arduino controls two LEDs connected to digital pins.
Operation:
- LED 1 ON → LED 2 OFF
- LED 1 OFF → LED 2 ON
- Repeat continuously
This demonstrates:
- Digital Output Control
- Timing using delay()
- Basic Arduino Programming
Circuit Diagram
Assemble the Circuit
- Place Arduino Uno beside the breadboard.
- Insert the Red LED into the breadboard.
- Insert the Green LED into the breadboard.
- Connect a 220Ω resistor to the anode (+) of each LED.
- Connect:
- Red LED resistor to Arduino Pin 8
- Green LED resistor to Arduino Pin 9
- Connect both LED cathodes (-) to GND.
Double-check all wiring before powering the Arduino.
Open Arduino IDE
- Install Arduino IDE if not already installed.
- Connect Arduino Uno using USB cable.
- Open Arduino IDE.
- Select:
Tools → Board → Arduino Uno
- Select the correct COM port
Upload the Code
Copy and paste the following code:
Click Verify and then Upload.
Observe the Output
After uploading:
- Red LED lights up
- Green LED remains OFF
- After 0.5 seconds, Red LED turns OFF
- Green LED turns ON
- Pattern repeats forever
Output Pattern
Experiment With Timing
Try changing the delay value:
Result:
- Faster blinking
Or
Result:
- Slower blinking
How the Code Works
Define Pins
Stores the LED pin numbers.
Setup Function
Configures both pins as outputs.
Turn LEDs ON/OFF
Red LED ON, Green LED OFF.
Red LED OFF, Green LED ON.
Delay
Waits 500 milliseconds.
Troubleshooting
LED Not Lighting
- Check LED polarity.
- Long leg = Anode (+)
- Short leg = Cathode (-)
Upload Error
- Verify COM Port.
- Verify Arduino Uno board selection.
LEDs Both ON
- Check wiring connections.
- Ensure each LED is connected to the correct pin.
Future Improvements
You can extend this project by:
- Adding more LEDs
- Creating a police light effect
- Using RGB LEDs
- Controlling speed with a potentiometer
- Using push buttons to change patterns
Conclusion
You have successfully built an Alternate LED Blink project using Arduino Uno. This simple project introduces digital outputs, timing control, and Arduino programming fundamentals, making it an excellent starting point for more advanced electronics projects.