DEV Community

Cover image for LED Blinking Program For Arduino UNO
Shashank Tiwari
Shashank Tiwari

Posted on

LED Blinking Program For Arduino UNO

LED Blinking Program For Arduino UNO

Hello everyone, Now in this blog we are going to make LED Blinking Program for Arduino UNO, which is the basic project of the embedded system.
Let’s puts some LEDs and resistors to work. In this project, we will use one led and some resistor to make our project perfect (LED Blinking Arduino UNO).

LED Blinking Arduino UNO Algorithm

Before starting to write the algorithm of the project first know what is an algorithm. Basically Algorithm is a step-by-step method, which specifies a series of instructions to be executed to get the desired output in a certain order.

Algorithms are usually generated independently of the underlying languages, i.e. in more than one programming language, an algorithm may be implemented.

So, start writing the algorithm of our first project #1. Before going onto the algorithm part you should have a clear understanding of what is an Arduino UNO and basics parts.

Turn on the LED 1
Wait for a second
Turn off the LED 1
Repeat this process indefinitely
Required Components For LED Blinking Project In Arduino UNO
One led
A Resistor
One Bread Board
Wires
Arduino
USB Cables

Arduino Code For LED Blinking

Here is the code for LED Blinking Program.
lED BLINKING

//initialize variables (for pin)
int ledPin = 11;

void setup()
{
  //set the pin mode to output 
  pinMode(ledPin, OUTPUT);
}

void loop()
{
    // send a HIGH(ON) signal to ledPin which is pin 11
    digitalWrite(ledPin, HIGH);
    delay(1000);
    digitalWrite(ledPin, LOW);
    delay(1000);
}
Enter fullscreen mode Exit fullscreen mode

In void setup() at the digital, I/O pins are set to outputs because we want them to send current to the LED on demand. We specify when to turn led using the digitalWrite() function in the void loop() section of the sketch.

Use Variables

In a computer program, data is stored using variables. For instance, in Project (LED BLINKING ARDUINO UNO) we used the delay(1000) feature to hold the LED Turns on.

For more click here ->(https://hackthedeveloper.com/led-blinking-arduino-uno/)

Top comments (0)