Arduino LED Blinking Tutorial with code – #3

Arduino LED Blinking Tutorial with code – #3

Arduino LED Blinking

Hey Guys, welcome back to the Techatronic. in this article, we gonna make a tutorial on how to make Arduino LED blinking projects. There are many students who purchase Arduino from the online store and they try to make projects with their Arduino and learn. We are making a course on Arduino in which we will make step by step tutorial. in our previous tutorial, we explain how to set up Arduino IDE to upload the code.

 

In our last two tutorials, we explain the Arduino and the Arduino software and in this article, we will explain What is the basic components we required to make this first Project. it is simple and led blinking projects. in this project we blink an LED like, the led will glow for some time and then it will off automatically and the process repeats continuously. 

So here first we explain some terminology which helps you to familiar with the coding. so, as we know here in the Arduino there are a lot of libraries which run all the code in the Arduino. pinout, digitalWrite, digitalRead,delay. these are the terms which we gonna use to make the program. so let’s start with the program.

In the first step, we will define the pin and assign some value at that pin. 

Step #1

#define blinking 9

in the above line, we are assigning and variable LED to the 13 pins of Arduino 

 

Step #2

The second step is to make a void function as given below:-

Void Setup( )

 

void setup is the function to set the initial for the main functions. for example to set and output and input pins, setting up of baud rate, initiate another peripheral like Bluetooth, wifi, and much more. 

 

and there are two curly braces {} open and close we have to write the statement of function inside in these braces. there we initiate the program data as given as below

Step #3

{

pinMode{blinking, OUTPUT};   

( according to this statement the blinking variable which is assigned above on pin 9 will work as an output. the whole line meaning is the pin number 9 will act as output pin. here is a word pinMode which carr two words pin & Mode. it means on which pin what will be the mode.  either OUTPUT or INPUT. to understand in more detail ou must read this Arduino introduction article. where all I have given about it. ) 

}

Now we will move towards another void which is known as the 

Step #4

void loop()

 

the void loop is the function to write main functions that will run continuously as we know the loop means the program will be run till the break statement inside the loop . for example if I write there a code for led blinking the code will run continuously infinite time. 

 

and there are two curly braces {} open and close we have to write the statement of function inside in these braces. 

Step #5

{

digitalWrite(blinking, HIGH);

(the above statement saying that the blinking which is assigned on pin 9 will be given the HIGH(+5v) value so that LED will glow, digitalWrite is a term which used to write this statement.  )

delay(1000);

(according to this statement there will be a delay of 1 sec )

digitalWrite(blinking, LOW);

(the above statement saying that the blinking which is assigned on pin 9 will be given the LOW(+5v) value so that LED will off, digitalWrite is a term which used to write this statement.  )

delay(1000);

(according to this statement there will be a delay of 1 sec )

}

full LED blinking code Arduino 

#define blinking 9

void setup()

{

pinMode(blinking, OUTPUT);

}

void setup()

{

digitalWrite(blinking, HIGH);

delay(1000);

digitalWrite(blinking, LOW);

delay(1000);

}

note * the code is case sensitive so don’t forget to write right. 

Components Required to make Arduino LED blinking:-

  • Arduino 
  • resistor
  • Arduino cable 
  • LED 
  • Breadboard
  • jumper wire

Arduino LED blinking circuit diagram. 

arduino led blinking circuit

This Post Has 2 Comments

Comments are closed.