LEDs are small, powerful lights that are used in many different applications. To start off, we will work on blinking an LED, the Hello World of microcontrollers. That’s right - it’s as simple as turning a light on and off. It might not seem like much, but establishing this important baseline will give you a solid foundation as we work toward more complex experiments.

Parts Needed

You will need the following parts:

  • 1x Breadboard
  • 1x RedBoard or Arduino Uno R3
  • 1x LED
  • 1x 330? Resistor
  • 2x Jumper Wires

Suggested Reading

Before continuing on with this experiment, we recommend you be familiar with the concepts in the following tutorial:

Hardware Hookup

Ready to start hooking everything up? Check out the Fritzing diagram and hookup table below, to see how everything is connected.

Polarized Components Pay special attention to the component’s markings indicating how to place it on the breadboard. Polarized components can only be connected to a circuit in one direction. Polarized components are highlighted with a yellow warning triangle, in the table below.

Please note: Pay close attention to the LED. The negative side of the LED is the short leg, marked with a flat edge.

LED drawing

Components like resistors need to have their legs bent into 90° angles in order to correctly fit the breadboard sockets. You can also cut the legs shorter to make them easier to work with on the breadboard.

Bent resistor

Fritzing Diagram for RedBoard

alt text

Having a hard time seeing the circuit? Click on the Fritzing diagram to see a bigger image.

Fritzing Diagram for Arduino

alt text

Having a hard time seeing the circuit? Click on the Fritzing diagram to see a bigger image.

Hookup Table

Component RedBoard or Arduino Uno R3 Breadboard Breadboard
LED    c2 LED ( + ) c3 LED ( - )
330 Resistor   a3 ( - )
Jumper Wire GND ( - )  
Jumper Wire PIN 13 e2  

In the table, polarized components are highlighted in yellow for the whole row and a warning triangle. Polarized components only be connected to a circuit in one direction.

Open Your First Sketch

Open Up the Arduino IDE software on your computer. Coding in the Arduino language will control your circuit. Open the code for Circuit 1 by accessing the “SIK Guide Code” you downloaded and placed into your “examples” folder earlier.

To open the code go to: File > Examples > SIK Guide Code > Circuit_01

alt text

Code to Note

pinMode(13, OUTPUT);

Before you can use one of the Arduino’s pins, you need to tell the RedBoard or Arduino Uno R3 whether it is an INPUT or OUTPUT. We use a built-in “function” called  pinMode() to do this.

digitalWrite(13, HIGH);

When you’re using a pin as an OUTPUT, you can command it to be HIGH (output 5 volts), or LOW (output 0 volts).

What You Should See

You should see your LED blink on and off. If it isn’t, make sure you have assembled the circuit correctly and verified and uploaded the code to your board, or see the troubleshooting section.

Real World Application

Almost all modern flat screen televisions and monitors have LED indicator lights to show they are on or off.

alt text