You are here
Home > DIY > 5 SIMPLE WAYS TO BLINK AN LED USING ARDUINO

5 SIMPLE WAYS TO BLINK AN LED USING ARDUINO

5 SIMPLE WAYS TO BLINK AN LED USING ARDUINO
CLICK HERE TO SHARE

LEDs have been used in so many applications such as building electronic projects etc. They are very fascinating and user friendly. To begin with, let’s learn how to blink an LED using the Arduino programmer board. Having full knowledge of how LEDs work is necessary because this is the foundation to help you work through complex projects.

 

COMPONENTS REQUIRED to BLINK AN LED USING ARDUINO:

Following components will be needed:

  • 1 × Breadboard
  • 1 × Arduino Uno R3 or Arduino mega 2560
  • 1 × LED
  • 1 × 220Ω Resistor
  • 2 × Jumper.

PROCEDURE TO BLINK AN LED USING ARDUINO:

Below is the circuit diagram illustrating how to connect LED with Arduino board.

image demonstration how to build an LED

BREADBOARD:

A breadboard is a project board that helps circuit builders to prototype their project first before assembling it together.

breadboardImage

breadboard image

 

LED:

LED(light-emitting diode)  is the small bulb use on the breadboard. It has two terminal, one is long while the other is short. The longer leg is the positive terminal while the short leg is the negative terminal.

images

 LED image

NOTE: make sure to identify the polarities before connecting it to avoid the error which can cause LED not to blink.

RESISTOR:

As the name implies, it resists the flow of electric current through the LED. It has two terminals and no polarity, meaning that the LED can be connected to any of the terminals of the resistor without damaging it.

RESISTOR

Resistor image

 

JUMPER WIRE:

These are wires used to connect the LEDs, RESISTOR AND ARDUINO BOARD together.

ARDUINO SKETCH:

Open the Arduino IDE software on your computer. Open a new sketch to write your program so as to control the blinking LED.

ARDUINO CODE:

/* Program to demonstrate how to blink an LED */

// the setup function runs only once

const int led = 13; //using digital pin 13
void setup() {  // initialize digital pin 13 as an output.
   pinMode(led, OUTPUT);
}

// the loop function runs over and over again forever

void loop() {
   digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
   delay(1000); // wait for a second
   digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
   delay(1000); // wait for a second
}

Code explanation:

pinMode(led, OUTPUT)

– Before you can use one of Arduino’s pins, you need to tell Arduino Uno or mega whether it is an INPUT or OUTPUT. pinMode() function help to do this for us.

digitalWrite(led, HIGH)

−  this is another function that is useful in Arduino programming, it helps to set the LED HIGH(5 volts) or LOW(0 volt).

Delay()

-this function helps to toggle the LED on and off for some seconds.

RESULT:

After uploading the code, You should see the LED blinking on and off depending on the delay time set.

CLICK HERE TO SHARE
Mba

Leave a Reply

Top
Enable Notifications    Ok No thanks