Alternate LED Blink

by Supernova09 in Circuits > Arduino

128 Views, 1 Favorites, 0 Comments

Alternate LED Blink

ChatGPT Image Jun 25, 2026, 11_03_41 PM.png
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:

  1. LED 1 ON → LED 2 OFF
  2. LED 1 OFF → LED 2 ON
  3. Repeat continuously

This demonstrates:

  1. Digital Output Control
  2. Timing using delay()
  3. Basic Arduino Programming


Circuit Diagram

Screenshot 2026-06-25 230821.png
Arduino UNO

D8 ---- 220Ω ---->| Red LED ---- GND

D9 ---- 220Ω ---->| Green LED ---- GND


Assemble the Circuit

  1. Place Arduino Uno beside the breadboard.
  2. Insert the Red LED into the breadboard.
  3. Insert the Green LED into the breadboard.
  4. Connect a 220Ω resistor to the anode (+) of each LED.
  5. Connect:
  6. Red LED resistor to Arduino Pin 8
  7. Green LED resistor to Arduino Pin 9
  8. Connect both LED cathodes (-) to GND.

Double-check all wiring before powering the Arduino.

Open Arduino IDE

  1. Install Arduino IDE if not already installed.
  2. Connect Arduino Uno using USB cable.
  3. Open Arduino IDE.
  4. Select:

Tools → Board → Arduino Uno

  1. Select the correct COM port


Upload the Code

Copy and paste the following code:


// Alternate LED Blink

const int led1 = 8;
const int led2 = 9;

void setup()
{
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
}

void loop()
{
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
delay(500);

digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
delay(500);
}

Click Verify and then Upload.

Observe the Output

After uploading:

  1. Red LED lights up
  2. Green LED remains OFF
  3. After 0.5 seconds, Red LED turns OFF
  4. Green LED turns ON
  5. Pattern repeats forever

Output Pattern

Time →

Red LED ON OFF ON OFF ON
Green LED OFF ON OFF ON OFF



Experiment With Timing

Try changing the delay value:


delay(200);

Result:

  1. Faster blinking

Or


delay(1000);

Result:

  1. Slower blinking


How the Code Works

Define Pins


const int led1 = 8;
const int led2 = 9;

Stores the LED pin numbers.

Setup Function


pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);

Configures both pins as outputs.

Turn LEDs ON/OFF


digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);

Red LED ON, Green LED OFF.


digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);

Red LED OFF, Green LED ON.

Delay


delay(500);

Waits 500 milliseconds.

Troubleshooting

LED Not Lighting

  1. Check LED polarity.
  2. Long leg = Anode (+)
  3. Short leg = Cathode (-)

Upload Error

  1. Verify COM Port.
  2. Verify Arduino Uno board selection.

LEDs Both ON

  1. Check wiring connections.
  2. Ensure each LED is connected to the correct pin.


Future Improvements

You can extend this project by:

  1. Adding more LEDs
  2. Creating a police light effect
  3. Using RGB LEDs
  4. Controlling speed with a potentiometer
  5. 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.