Javatpoint Logo
Javatpoint Logo

Blinking an LED

It is the simple basic project created using Arduino. LED (Light Emitting Diode) is an electronic device, which emits light when the current passes through its terminals. LED's are used in various applications. It is also used as an ON/OFF indicator in different electronic devices.

In this project, we will connect the LED to the digital pin on the Arduino board. The LED will work as a simple light that can be turned ON and OFF for a specified duration.

Structure of LED

An LED is a two-terminal device. The two terminals are called as Cathode and Anode.

It is shown below:

Arduino Blinking an LED

The long terminal is called Anode, and the shorter terminal is called Cathode. Here, cathode is the negative terminal and anode is the positive terminal.

Components of the project

The components used in the blinking of an LED are listed below:

  1. 1 x Arduino UNO board.
    We can use any version of the UNO board, such as UNO R3, etc. We can also use other types of Arduino boards, such as Arduino Zero, Arduino Micro, etc.
  2. 1 x Breadboard
  3. 2 x Jump wires
  4. 1 x LED
  5. 1 x Resistor of 220 Ohm.

We can use a resistor of any value upto 470 Ohms. We can use other value of resistors as well, depending on our circuit requirements. Usually, the value should not exceed the allowable forward current.

Structure of the project

The structure clearly shows the pinout of the UNO board. It also displays the LED and resistance connected to the board.

It is shown below:

Arduino Blinking an LED

Sketch

We need to install the Arduino IDE, to begin with the coding, which is already discussed.

Open the IDE and start with the coding, which is given below:

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

Every statement of coding is explained in Arduino coding basics. You can open the URL for clear understanding.

Note: Make sure the code is free of errors.

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

Arduino Blinking an LED

We are required to click on the Verify button 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:

  • Attach an LED on the breadboard. We need to plug-in the two terminals of an LED into the holes of the breadboard.

We can plug-in the LED anywhere on the breadboard.

  • Connect the resistor in series with the LED, as shown below:
Arduino Blinking an LED
  • 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 8.
  • Connect the negative/shorter terminal (Cathode) of the LED to the GND pin of the UNO board using the wire, as shown below:
Arduino Blinking an LED

Here, the orange wire is connected to the PIN 8, and the blue wire is connected to the GND.

The shorter terminal indicates the negative. 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.

Important points

The important points to be considered in this project are listed below:

  • The resistor must be connected in series with the LED.

The resistor prevents the excess current from reaching the LED. The excess current in the connection can burn the LED. Hence, a resistor in series with the LED is used in the connection.

  • We can use any pin as the OUTPUT pin. For example, 8, 13, 7, 4, and 3. The other pins are PWM and analog pins.
  • One terminal of the LED is connected to the Ground while the other terminal is connected to the digital pin. The digital pin has only two values 0 or 1.
    • HIGH = 1
    • LOW = 0
  • Arduino UNO board is recommended for all basic projects because it is easy to understand and implement. It is also the standard Arduino board from all types of boards used. It supplies power and also acts as a serial port.

Next TopicBlinking Two LED





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA