Sign in Go Pro

Introduction to Android Things

Peripheral IO, learning GPIO input with a Capacitive Button

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next



This lesson is going to show you how to interact with the Android Things Peripheral IO APIs to understand and communicate with a GPIO input peripheral. In this case a capacitive touch button. Using this peripheral to code an IoT android app.

We will learn about General Purpose Input Output and how to read and use the documentation to help us code a GPIO input peripheral. We will discuss the GPIO API's, how to deal with IOExceptions in your app, how to manage hardware resources and how Android Things works with the Android lifecycle. Coding an android application to communicate with the Rainbow Hat capacitive touch buttons and display the results from our app.

When complete, you will have learnt the basics of GPIO input peripheral communication and also written an Android Things application that will print out a message when you press and release this hardware button.

Hardware needed.

For this lesson you will require:
- A Raspberry Pi 3 flashed with Android Things
- A Rainbow Hat peripheral

If you need to buy the Raspberry Pi to start with Android Things I would recommend this kit. It contains:

  • Raspberry Pi 3
  • Rainbow HAT
  • Pibow Coupé for Android Things
  • 2.5A official Raspberry Pi worldwide power supply
  • 8GB microSD card


There are no comments on this lesson, start the conversation below ...


Lessons in Introduction to Android Things