Led blinking with Arduino UNO R3

Led blinking with Arduino UNO R3, this article give you brief review of how to use digital pins of Arduino UNO R3 as an input or output. I have also discussed how to use Proteus to learn Arduino UNO R3 if you don’t have its hardware board and how to write your first program or sketch for Arduino UNO R3. In this project two LEDS are connected with digital input/output pins of Arduino UNO R3. Arduino will turn on only one LED at a time and other will remain off for that time.

Note : if you don’t know about pins of Arduino UNO R3 , first read following article.
 Getting started with Arduino UNO R3

Circuit description :

Circuit diagram led blinking with Arduino is shown below.

Led blinkin using Arduino UNO R3

Led blinkin using Arduino UNO R3

Two LEDS are connected with pin number 7 and 8 of Arduino board. Resistor R1 and R2 is used as a current limiting resistor.Maximum output voltage at Arduino pins is about 5 volt. By using maximum output voltage value one can easily calculate current limiting resistor value. Maximum current from these pins can never be greater than 30mA. Current output greater than 30mA damage Arduino board permanently. So by use maximum voltage and current limit, one can easily calculate resistance value.  For example

Vmax = 5 volt




Imax = 30mA

voltage drop across LED = 0.7 volt

Hence by using ohm law V = I * R

R =  5 – 0.7 volt / 30 m A = 150 ohm

But I recommend you to use resistor value more than calculated, to ensure safety of your Arduino board.

Programming :

Programming of Arduino is just like learning vocabulary of any language. You just have to learn name of some specific functions to use them in your program. If you know little bit about c programming like if/else statements, loops and switch statements, then you can easily learn Arduino programming by learning name of few specific functions. In this tutorial of led blinking, two functions are used. One is used to declare pin 7 and 8 as a output . Second function is used for making pin high and low. Functions names are given below :

pinMode(pin number, OUTPUT) : pinMode is name of function. Pin number and OUTPUT are arguments of function. For example, we have connected pin 7 and 8 with two leds and want to use pin 7, 8 as a output to blink LEDS. So above function can be used to declare pin 7 and 8 as a output pins as given below :

pinMode (7, OUTPUT)  i.e 7 is specified the pin number and OUTPUT tells Arduino that declare pin seven as OUTPUT pin.

pinMode (8, OUTPUT)  i.e 8 is specified the pin number and OUTPUT tells Arduino that declare pin seven as OUTPUT pin.

digitalWrite(pin number, HIGH/LOW) : digitalWrite is a name of function. This function make specified pin number in arguments either high and low. Remaining all the things in code given below are self explanatory.

void setup()

{

pinMode(7, OUTPUT);

pinMode(8, OUTPUT); 

}

void loop()

{
digitalWrite(7, HIGH);
digitalWrite(8, LOW);
delay(1000);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
delay(1000);
}

But now the question is how to add above code in Proteus simulation ? To know about it watch following video :


LED blining Project using Arduino UNO R3 by bilalmalikuet

In above code delay() funtion is used to insert delay of 1000ms between LEDS blinking. if you still have any issue feel free to comment on this post.

To download complete files of this project visit following link :

LED Blinking using Arduino UNO R3 

Add Comment

Subscribe to our blog to get updates in your email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 704 other subscribers