Arduino: How To Make An LED Blink

In this tutorial we will make an LED (light emitting diode) blink at specific intervals.

Items you will need:

  • 1 Arduino (UNO or equivalent)
  • 1 USB cable
  • 1 Breadboard
  • 3 connection wires (preferably male-male breadboard jumper wires and in 3 different colors. In this tutorial we will use Black for Ground, Red for 5v and Yellow for Arduino output).
  • 1 LED (light emitting diode) – 5 mm; leg yes; color Red (633nm)
  • 1 330 Ω Resistor – tolerance ±5%; resistance 330Ω

Component notes:

  • Arduino – please refer to “What Is An Arduino?” https://www.sysrecon.com/?p=15
  • LED (light emitting diode) – Make sure the short leg, marked with a flat side goes into the negative position (-)
  • 330 Ω Resistor – The color bands should read Orange, Orange, Brown, Gold. The direction of the resistor when placed on the breadboard is irrelevant.

To determine which resistor to use, please check the chart below:

Resistor Color Chart

 

4 Band Resistor Calculator

 Some resistors have the color bands grouped together  close to one end. Hold the resistor with the closely grouped bands to your left and read the resistor from the left to the right. Also, the first band can’t be silver or gold.

 

The schematic of the circuit we will be creating is as follows:

Arduino Blink Basic Schematic

Arduino LED Blink Detailed Schematic

Our finished circuit will look as follows:

Arduino Blink Breadboard

  • LED GOES FROM D10(+ anode) TO D11(- cathode)
  • 333O Resistor GOES FROM B11 TO Anywhere on breadboard ground (- GND)
  • Black Jumper Wire GOES FROM Arduino GND TO Breadboard Ground(-)
  • Red Jumper Wire GOES FROM Arduino 5V TO Breadboard Power (+)
  • Yellow Jumper Wire GOES FROM Arduino PIN13 TO Breadboard E10

Now that the circuit is built, we can connect the Arduino to our computer. Once it is connected open up the Arduino Integrated Development Environment (IDE). Before we start adding the code, click on Tools → Board and select the correct Arduino board you are using. Next, click on Tools → Serial Port and select your correct port. Once the IDE is setup enter the code below either by typing, copy and paste or by downloading from https://www.sysrecon.com/downloads/arduino/blink.ino

 

/*
Blink
Turns on an LED on for five seconds, then off for five seconds, repeatedly.

This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(5000); // wait for 5 seconds
digitalWrite(led, LOW); // turn the LED off by making voltage LOW
delay(5000); // wait for 5 seconds
}

Once you have entered the code into the IDE, click verify to ensure the code compiles and then click upload to get the sketch onto your Arduino.

Arduino IDE Verify and Upload

After a few seconds the Arduino will restart and you will see the sketch begin to execute.

You should also notice that the Arduino has an LED on-board that will sync to your LED on the breadboard. If you do not have the components to create this circuit, you can still test the source code with the Arduino’s on-board LED.

We hope you enjoyed this Arduino tutorial. Keep checking back as there will be many more to come!