Blog

Arduino UNO: Single Blinking LED

This entry is part 4 of 12 in the series All About Arduino

This program will help you understand the working of Arduino UNO that how it glows the inbuilt LED connected to pin-13 on the development board of Arduino UNO.

How to use given program?

  • First open the Arduino Software, by double clicking its shortcut icon, on your desktop.
  • Click on File and then NEW to create new file for this program.
  • Now copy the following program and then paste it into your Arduino Software new file.
  • Press Ctrl-S on the keyboard of your PC to save the program.
  • Now connect the Arduino UNO development board to your PC with data cable given to you.
  • Click on Tools in the menu of Arduino UNO software and then PORT.
  • Select the given COM port as shown by your PC. It may be COM3, COM4 or something like that.
  • Then click on UPLOAD button to upload your program into Arduino UNO dev. board.
  • Wait for some time and the observe the LED on it.
  • It will start blinking as per the rate given in the program.
  • Now finally try changing the delay(1000); value to different values and observe the working of the LED.
  • So wish you happy programming…!

Tested Code

The lab tested code is given below. You can also download the text file of this code. Copy the complete code and then paste it into your Arduino Software by creating new project.


/*
 * Single Blinking LED program for Arduino UNO
 * Date: 24.11.2018
 * Vidyasagar Academy, Akola
 */

int LED=13; // The variable LED is assigned to pin-13

void setup() // Here we define the output or input pin
{
  pinMode(LED, OUTPUT); // defined pin-13 as output pin
}

void loop() // infinite loop to produce continuous action
{
  digitalWrite(LED, HIGH); // LED will become ON
  delay(1000); // it will remain ON for 1 second
  digitalWrite(LED, LOW); // LED will become OFF
  delay(1000); // it will remain OFF for 1 second
  // after this last line the program will start again
  // and again to repeat the blinking of the LED 
  // up to infinity.
}

You can also connect number of such LEDs to different pins to the Arduino UNO Development Board, as shown below.

setup of connecting number of LEDs to Arduino Board