Skip to content

Most visited

Recently visited

navigation

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
Intel Joule J7_71 J6_25
NXP Argon i.MX6UL GPIO3_IO01 GPIO3_IO06
NXP Pico i.MX6UL GPIO4_IO20 GPIO4_IO21
NXP Pico i.MX7D GPIO_39 GPIO_34
Raspberry Pi BCM21 BCM6

""

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

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

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.