Buy Aruino   Buy Arduino Uno on AliExpress

How to Blink LED with Arduino

You might have seen blinking Led on decorative lightning, 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 millisecond) you pass in it.

The program will stop executing for that period of time means it will not execute lines below it.

Ардуино+