Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Android Things Quick Start Guide

You're reading from   Android Things Quick Start Guide Build your own smart devices using the Android Things platform

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher Packt
ISBN-13 9781789341799
Length 192 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Raul Portales Raul Portales
Author Profile Icon Raul Portales
Raul Portales
Arrow right icon
View More author details
Toc

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 $19.99/month. Cancel anytime