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

LED strip

As we have done in previous chapters, let's remove the dependency of the Rainbow HAT meta driver and add only the driver that we need. In the case of the RGB LED strip, that driver is called driver-apa102:

dependencies {
implementation 'com.google.android.things.contrib:driver-apa102:+'
}

And, as we have been doing so far, let's use a BoardDefaults object to be able to run our code independently of the developer kit pinout naming:

val spiBus: String
get() = when (Build.DEVICE) {
DEVICE_RPI3 -> "SPI0.0"
DEVICE_IMX7D_PICO -> "SPI3.1"
else -> throw IllegalStateException("Unknown Build.DEVICE ${Build.DEVICE}")
}

There are a couple of important things to note here. First is that the exposed SPI bus on the Raspberry Pi is called 0, while the iMX7D one is 3. It is also important to note...

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 €14.99/month. Cancel anytime}