You are currently viewing Blinking an LED with Arduino

Blinking an LED with Arduino

Table of Contents

[1] Description

[2] Component List

[3] Working & Code

[4] Output Video

[5] YouTube Video

[1] Description

In this project I’m going to make an LED blink and this is a simplest or I can say first program in the Arduino learning journey. In this project we will use simple delay function to ON and Off an LED and this delay function will convert as a blinking condition. So Let’s start with this project below are the list of required components.

Here is PDF file of this project.

[2] Component List

[1] Arduino

[2] LED

[3]Jumper wires

[4] USB cable for Arduino

[3] Working & Code

Before start first you have to install Arduino IDE , here is the link to download . Download latest version as per your system specification.

Download :-https://www.arduino.cc/

After downloaded open the Arduino IDE and this will look like this as given below in the image.

Arduino IDE

Here we will write the code for LED blink . As you can see two function already present these two function are the important parts of Arduino programming. Let’s understand the these functions.

void setup :- In this we will write those statement which we want to run only once or I can say if we want to run any statement run at the start of the code.

Void loop :- In this we will write those statement which we want to run again and again or I can say in a loop , it may be infinite or as per your condition limit.

So this blinking will be done with the use of loop function because we know to blink we want a continuous repeating function, so will use this, let’s understand the code line by line.

int led=2;
void setup() 
{
 pinMode(led,OUTPUT);
 digitalWrite(led,LOW);
}
void loop() 
{
  digitalWrite(led,HIGH);
  delay(500);
  digitalWrite(led,LOW);
  delay(500);
}

This is the code which I have wrote for this blinking project and this is the very simple code ,let’s understand it how it’s working?

int led=2;

In Above line I have declare the LED pin as pin number-2(D2) of Arduino , if you want you can use other pin also.

void setup() 
{
 pinMode(led,OUTPUT);
 digitalWrite(led,LOW);
}

This above part is setup part so here I declared LED pin as Output pin and also set LOW for initially.

void loop() 
{
  digitalWrite(led,HIGH);
  delay(500);
  digitalWrite(led,LOW);
  delay(500);
}

This is the main part of the code where LED switching between On and Off. Here first I have set LED as HIGH and then I used delay function for a 0.5sec(500ms) and this delay function will keep the LED on for 0.5sec. And after that I have set the LED as LOW for the same time. This turns LED into the blinking LED and if you want fast blinking or slow you can play with that delay time.

After done with coding part let’s go for the connection. Now connect the LED with Arduino as per the circuit diagram given below and then connect your Arduino with PC through USB cable.

Circuit-Diagram

Now connect Arduino and check for the port as well as board. Select board as per your Arduino board here I’m using Arduino Nano so I have selected that board. Follow these steps to select board and port as given below.

To select the Board
To select the port

Now click on Upload button and this is the last part of this project , now you have completed with this project. Below, with output vide0 YouTube video also given , if you have any doubt or not understand well go and check out YouTube video.

[4] Output Video

Output-Video

[5] YouTube Video

Thankyou so much to read the article till now there is YouTube video on this project so please go through that video to understand the whole procedure in a better manner there is link for video go and check it out.