Skip to content

Most visited

Recently visited


Connect the Hardware

This lesson teaches you to

  1. Connect a button to GPIO
  2. Connect an LED to GPIO

You should also read

Before writing any code, you need to connect peripherals from your development kit to your board.

In this lesson, you will learn to wire a pushbutton switch and LED from a breadboard to your device. To connect the peripherals to your board:

  1. Connect one side of the button to the chosen GPIO input pin, and the other side to ground.
  2. Connect the same GPIO input pin to +3.3V through a pull-up resistor.
  3. Connect the chosen GPIO output pin to one side of a series resistor.
  4. Connect the other side of the resistor to the anode side (longer lead) of the LED.
  5. Connect the cathode side (shorter lead) of the LED to ground.

For this lesson, the following GPIO pins are assumed on each board:

Board Input Signal Output Signal
Intel Edison Arduino IO12 IO13
Intel Edison Sparkfun GP44 GP45
Raspberry Pi BCM21 BCM6


This site uses cookies to store your preferences for site-specific language and display options.


This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.