Javatpoint Logo
Javatpoint Logo

Blinking Two LED

We have already discussed a project of blinking an LED. Here, we will discuss a project of blinking two LED's.

The concept of blinking two LED's is similar to the blinking of a single LED. As we know, we can use the resistance of any value, so let's take the resistors of 470 Ohms. The resistors reduce the amount of current reaching the LED, which saves the LED from being burnt.

We can also use other resistors depending on the circuit limit and requirements.

Let's start with the project.

Structure of two LED's

The structure of red and green LED is shown below:

Arduino Blinking Two LED

The long terminal is called Anode (positive charged), and the short terminal is called Cathode (negative charged).

Components

The components used in the project are listed below:

  1. 1 x Arduino UNO board.
    We can also use other types of Arduino boards, such as Arduino Mega, Arduino Micro, etc.
  2. 1 x Breadboard
  3. 4 x Jump wires
  4. 1 x Red LED
  5. 1 x Green LED
    We need to take 2 LEDs of any color. Here, we will use the red and green color LED.
  6. 2 x Resistor of 470 Ohm.

Structure of the project

Here, we will use the digital output pin number 13 and 7. The positive terminal of the red LED is connected to the PIN 13, and the negative terminal (anode) is connected to the ground.

Similarly, the positive terminal (cathode) of the green LED is connected to PIN 7 and the negative terminal is connected to the ground.

As mentioned, two resistors each of 470 Ohms, will be connected in series to the two LEDs in the project.

The structure will represent the pinout diagram of the project. It is shown below:

Arduino Blinking Two LED

Sketch

Open the Arduino IDE (Integrated Development Environment) and start with the coding, which is given below:

We can modify the delay duration according to our choice or as per the requirements.

The sketch will be uploaded to the board after the correct compiling, as shown below:

Arduino Blinking Two LED

Click on the Verify button present on the toolbar to compile the code.

The RX and TX LED on the board will light up after the successful uploading of the code.

Procedure

The procedure to join the components of the project is shown below:

  • Plug-in the two LED adjacent to each other on the breadboard.
  • Now, plug-in the resistors of 470 Ohm in series with the two LED, as shown below:
Arduino Blinking Two LED

We need to check that the plug-in is performed correctly, as shown above. For any confusion, check the pin diagram shown above in the heading- Structure of project.

  • Connect the left leg of the resistor (connected in series with red LED) to the digital output pin of the UNO board, i.e., PIN 13.
  • Connect the left leg of the resistor (connected in series with green LED) to the digital output pin of the UNO board, i.e., PIN 7.
  • Connect the negative/shorter terminal (Cathode) of the red and green LED to the GND pin of the UNO board using the wire, as shown below:
Arduino Blinking Two LED

Here, the red wire is connected to the PIN 13, and the blue wire is connected to the GND.

Similarly, the green wire is connected to the PIN 7, and the orange wire is connected to the GND.

Note: The different colors of wire are used only for a better understanding.

The shorter terminal indicates the ground. So, we will connect the shorter terminal to the Ground (GND).

  • Connect the USB cable.
  • Select the board and serial port in the Arduino IDE.
  • Upload the sketch or code on the board.
  • The LED will dim and light for the specified duration. Here, the green and red LED will light alternatively.

It means when the red LED will be ON, the green LED will be OFF and vice versa.






Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA