This tutorial may be outdated. It is no longer recommended for beginners, and may need modifications to code or hardware that is not indicated in the tutorial.

Hardware

The examples in this guide are no longer supported and may not work. We are only supporting CircuitPython on our boards. For more information about using CircuitPython, check out the CircuitPython Essentials: https://learn.adafruit.com/circuitpython-essentials/circuitpython-essentials

Parts

You'll need the following parts to follow this guide:

  • A board running MicroPython.  Check this how to load MicroPython on a board guide for more information on getting MicroPython on a board.  If you're new to MicroPython and don't have a board yet, consider the Feather HUZZAH ESP8266 as a great beginner option.  If the board you're using has a user-controllable LED on it, like the Feather HUZZAH ESP8266, you actually don't need any more parts and can skip everything else below.
  • LED.  Almost any basic LED will do, but be sure it's not something fancy like a RGB multicolor or NeoPixel style digital addressable LED.  You want a basic LED that has two leads, one short one and one long one--these 5mm diffused red LEDs are perfect.
  • ~560-3k ohm resistor.  You need to use a resistor to limit the current that can flow through the LED (otherwise you might send too much current through the LED and damage it or the MicroPython board!).  The exact value of the resistor usually doesn't matter here, anything in the 560-3,000 ohm range should work great (higher resistance will be lower current and usually dimmer LED).  If unsure grab a 2200 ohm resistor pack.
  • Breadboard & jumper wires.  You'll use these parts to hold the LED and MicroPython board and connect wires between them.  If you've never used a breadboard before be sure to check out this guide on what they are and how to use them.

If you're totally new to hardware and starting from scratch you might want to pick up the Adafruit Parts Pal pack.  This pack includes a small breadboard, wires, LEDs, resistors, and more.  The parts pal plus a board running MicroPython are all you need to follow this guide!

Wiring

If your MicroPython board doesn't have a built-in LED you can control, or if you're just curious to experiment you can wire a LED to your MicroPython board as follows.

First identify a 'digital GPIO' or general purpose input/output pin on the board. Usually these are assigned numbers, like 0, 1, 2, 3, etc.  Check the guide or documentation for your board to see more details on the pinout and which pins are digital GPIO.

Note the BBC micro:bit doesn't easily plug in to a breadboard like other boards.  However you can use alligator clip wires to connect from the board's pins to wires that plug into a breadboard.

Next wire your LED to the digital GPIO pin as follows (this is an example of the Feather HUZZAH ESP8266 with a LED wired to pin 15):

  • Digital GPIO 15 is connected to the anode, or longer leg, of the LED.  It's very important to use the correct leg of the LED otherwise it won't light up as expected!
  • The cathode, or shorter leg, of the LED is connected to one side of the resistor (unlike the LED it doesn't matter which way you orient the resistor).
  • The other side of the resistor is connected to the board's ground or GND pin.
This guide was first published on Aug 18, 2016. It was last updated on Aug 18, 2016. This page (Hardware) was last updated on Jun 16, 2019.