How to Blink LED with Arduino

You might have seen blinking Led on decorative lightnings, one you might use on Christmas. Well question is that how do they work?

There are several methods to Blink LED. But we will be limited to blink it with Arduino which is very easy.

HARDWARE REQUIRED

  • Arduino Board
  • LED
  • BREADBOARD
  • Hook up wire ( to connect LED to Arduino )

Circuit Diagram

Anode (bigger leg of LED) is connected to the resistor then to the digital pin 13 and cathode is connected to the ground, this completes the circuit. Now the current will flow through the LED hence it will glow .

CODING

Sample program to blink the LED.

/* Sample program to blink the LED */
const pin =9 // pin to which LED is connected
Void setup()
{ pinMode(9,OUTPUT);
}
void loop()
{
digitalWrite(9,HIGH);
delay(2000);// Waits for 2 seconds
digitalWrite(9,LOW);
}

Functions Used

delay(): It waits for the time (in milli second) you pass in it. The program will stop executing for that period of time means it will not execute lines below it.

You can comment on the article below or ask a question on Uzabila QNA.

Top ↑

Sergei Ermilov

I create web projects, come up with ideas, develop, optimize and promote websites. The first steps in this direction were taken in 2008. If you have any ideas or want to suggest something, then write to me and my team.

Leave a Reply