Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Android Things Quick Start Guide

You're reading from  Android Things Quick Start Guide

Product type Book
Published in Aug 2018
Publisher Packt
ISBN-13 9781789341799
Pages 192 pages
Edition 1st Edition
Languages
Author (1):
Raul Portales Raul Portales
Profile icon Raul Portales

Buttons

The next component we are going to work with are capacitive buttons. The Rainbow HAT has three of them, labeled A, B, and C. Buttons can be handled in two different ways, using Buttons and using InputDrivers.

While Buttons are similar in behavior to the ones we place on a traditional UI, InputDrivers are similar to HID keyboards; they allow us to integrate with the operating system and send key press events, letting us handle our button presses as standard keys.

We will look at both of them with the same example: we will turn the red LED on when button A is pressed and off when it is not.

Let's start with the button driver.

Button driver

The simplest way to interact with a button is to use the button driver. This...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}