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.
You will need the following parts:
Before continuing on with this experiment, we recommend you be familiar with the concepts in the following tutorial:
|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.
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.
Fritzing Diagram for RedBoard
Fritzing Diagram for Arduino
Having a hard time seeing the circuit? Click on the Fritzing diagram to see a bigger image.
|Component||RedBoard or Arduino Uno R3||Breadboard||Breadboard|
|LED||c2 LED ( + )||c3 LED ( - )|
|330 Resistor||a3||( - )|
|Jumper Wire||GND||( - )|
|Jumper Wire||PIN 13||e2|
Open Your First Sketch
Code to Note
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.
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.