LED Blinking with Arduino- 1st Tutorial

Getting started with Arduino- this is our first tutorial on Arduino. we are starting an Arduino Course tutorial here. so, so have a chance to learn Arduino in free of cost. the students from the electronics department are searching for this kind of embedded course at coursera and udemy and there are all the courses are paid. but we are giving this complete course in free fo cost. we will start from the LED Blinking Tutorial.

Arduino:- Arduino is a Development Board with AVR microcontroller with a lot of features inside. you can use many sensors and module with the Arduino. if you want to interface any pushbutton you need to configure pins as input pins and output pins. and if you want to connect some analog sensor you need to connect with analog pins.

in this article, we are going to blink some LEDs from the Arduino. so first we need to know the working of the pins. Arduino having ATmega328p IC which is RISC based microcontroller. and it can work up to 16 MHZ clock frequency.  so, let’s understand the working of and the procedure.you can make many projects with Arduino board like a bluetooth RC car. 

 

0 AND 1’S Concept (HIGH and LOW):-

In this LED Blinking with Arduino task. we have to send some data from the Arduino. Arduino having 14 digital input-output pins. it means we can send data from the Arduino through the output configuration of pins or can also receive data from input. We send or receive data in the binary form it means 0 and 1. here 0 means 0v 0r GND and 1 means 3.3 v to 5v.

in the Arduino library, we can also call the 0 as LOW and 1 as HIGH. it doesn’t matter either we are writing 0 or LOW it will send the 0V at the desired pin. and we can also write the HIGH and 1 then the pin gets 3.3v to 5v.

so, this is the working principle ” when we send LOW to any pin it means the pin will get the 0v. and when we send HIGH to any pin it will get 5V“.

now talk about the what the input and what’s the output. There are many registers in the microcontroller which decides the work according to the currently active register. let’s discuss the registers.

There are some registers who decide the Input and output in the AVR microcontroller. But Arduino is advance development board and it has some library which activates the register according to the code. and to activate these registered there are some functions like pinMode we can configure our pin by using pinMode in Arduino, we have made smart dustbin using these principles

so, if you want to configure any pin of Arduino as OUTPUT pin you have to call the function pinMode

for example, if you want to make pin 6 as output pin you have to write pinMode(6, OUTPUT);

& if you want to make pin 6 as input pin you hate to write pinMode(6, INPUT);

this pinMode function is used to configure the pin as an output pin. but the thing what we want to send on these pins HIGH or LOW. so to write the Value on pin we use the digitalwrite. 

for example:- if you want to send HIGH on  pin 6 , you have to write digitalWrite(5, HIGH);  (send 5v to pin 5)

&   if if you want to send LOW on  pin 6 , you have to write digitalWrite(5, LOW);  (send 0v to pin 5)

 

Now, lets’ talk about the Connections for led blinking with Arduino 

led interface with arduino

when your send HIGH to the Arduino pin 6 it get around 5v value and to glow the led we have to connect a resistor also.

with pin number 6 first connect a resistor then positive terminal of the led then with the negative terminal connect ground from the Arduino.

Code for Led blinking with Arduino:-

void setup()

{

pinMode(6, OUTPUT); 

}

void loop()

{

digitalWrite(6, HIGH)

delay(1000);

digitalWrite(6, LOW);

delay(1000);

}

Let’s talk about the Code

Void setup() :- in this we define the things which execute only once. then in the whole program it configure as it is.

pinMode:-   use to configure the pin. as given in the above discussion.

Void loop():- as the name represents loop. the instruction in the void loop executes continuously.

digitalWrite:- it is used to send or write the value on the pin. either it LOW or HIGH. we discussed it in the above paragraph

delay:- the instruction execute very fast even can’t see the blinking of led. so we use the delay between the two instruction. and it is in the milliseconds. so for the 1 second of delay, we have to write 1000.

Now, Step to upload the program

  • download the Arduino IDE software in your pc.
  • open the Arduino IDE
  • create the new file
  • write the code into the IDE
  • Select the Port from the tool  as given in the picture

port select arduino ide

  • Compile the program and upload to the Arduino. as given in the below picture.

upload and complie program in arduino ide

 

Leave a Reply

Your email address will not be published. Required fields are marked *