Alternating blink is the second basic program to control two LEDs. This mini project covers the understanding of involving 2 Pins for output on the Arduino. To get started, you will need nothing to know about from the previous activity. Let’s start building and simplifying.
Things needed
- Arduino Uno
- USB cable
- 2 LEDs
- Breadboard
- Jumper cables
Connect the circuit
2 LEDs will be connected to digital pin 12 and 13 on the Arduino Uno as shown. The negative terminal of the LEDs are connected to the Arduino Uno Ground. Now both the LEDs are to be programmed as follow:
Condition 1: Red LED ON & Green LED OFF
Condition 2: Red LED OFF & Green LED ON
Let’s Code
Let us understand the code now! We want to turn the LEDs ON and OFF which is represented by HIGH( which means ON ) and LOW( which means OFF) in our code.
The wait(1) second block is added for us to see the nature of blink in the LED. The delay can be increased or decreased as per the users choice.