Arduino led blink


Arduino led blink
 Arduino led blink   






Arduino led blink code - Simple arduino projects for beginners. The simple led blink code and wiring is described in this project.

Arduino/ Arduinodroid tutorial series for beginners in electronics.

Both arduino windows and arduinodroid mobile app is same. So don't confuse.Also the libraries is the same.

Arduino windows / Arduinodroid mobile compatible led blink demonstration program is shown below.

Arduino mobile app - I personally use arduinodroid mobile app for programming arduino.


By default the led blink program outputs the 13th digital pin of arduino uno board.The arduino board itself will regulate the current flowing through the led using resistors.


If we need a custom led to blink outside the board we need to connect a separate led and resistor like this.Here Iam using the pin10(digital pin 10) as output.

The pin 10 will have positive voltage.So we must connect the positive pin of led to this pin and the negative pin of led is fed to the ground which is shown in the figure below.


How to find positive and negative lead of led?

LED pin arduino

LED pin arduino
LED pin arduino







Usually the long lead will be positive pin and the short pin will be the negative pin.

Here is the program for arduino led blink

You can see there are three main parameters in any program

----------

void setup()

{

}

void loop()

{

}

The upper side which is denoted as -----, Here we can add libraries and declarations


eg : If we want to include a library we write it as

#include<library.h>

Declarations: If we are going to declare a variable means we write the programs here

eg: int value=0;

int arduino_pin=2;

Don't add space like arduino pin.It will be taken as an error.


Void setup()

{

}

This is a function setup area of arduino c program.Here we can define the function of any pin.

eg:if we need a pin as digital output pin we can write as

pinMode(12,OUTPUT);

The same pin we can make as input also

pinMode(12,INPUT);

like that, or if we want to make hardware serial connection we write here as

Serial.begin(9600);

So what happens? The digital pins 0 and  1 will act as a serial output pins for delivering data to the external world.


void loop()

{

}

The void loop() is the main program body of arduino.We know that microcontroller is a device which continuously works because of the oscillator which is just like a clock.It will execute the program and repeat the same thing continuously in the loop section.

In other words we can say,

The loop will continuously look what is happening in the program.


Here is the simple program for arduino led blink


Program

void setup()

{

pinMode(10,OUTPUT); //Here the digital pin 6 is taken as output


//Note: Here // is used to uncomment so that after this session the compiler understand that don't include wordings after this symbol.

}

void loop()

{

digitalWrite(10,High); // On digital pin 10

delay(1000); //wait 1 second/1000 milliseconds

digitalWrite(10,LOW); // Off digital pin 10

delay(1000); //wait 1 second

}


Wiring

Arduino led blink
 Arduino led blink   







The resistor used here is a 220 ohms half watts resistor for regulating current flowing through the led. You can clearly see that the output is taken from pin 10 of arduino through a 220 ohms resistor.Its then given to the positive lead of LED. Similarly the ground pin(short pin) of led is given directly to ground(gnd) which is labelled on the arduino uno board.


Connect mobile phone to arduino through OTG.Upload the above program to arduino using windows  arduino software or arduinodroid mobile app.Sothat we can see led blinking in real world.

For Amazing & Simple Electronic Projects 


Previous Post Next Post