Sign in Go Pro

Introduction to Android Things

Creating a Peripheral IO Driver Library

12/05/2017

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Previous

About

This lesson is going to show you how to create a peripheral driver library in AndroidThings. We’ll discuss just what is a driver library and the benefits of using one. Then we will take an AndroidThings gesture sensor and convert it to a driver library. A driver library is a reusable piece of code that you can run to control a peripheral sensor or actuator at a higher level of abstraction without having to worry about how the peripheral works or its low level communication details. You can write them yourself or alternatively use driver libraries other people have written and published online. When complete, you will understand how to create and when driver libraries are useful in your Android Things applications. You will be able to modularise your IoT application and separate driver libraries for cleaner code and potential reuse on your other projects. This lesson references the code already written for the [ZX Sensor in this UART lesson](https://caster.io/lessons/android-things-peripheral-io-learning-uart-with-the-zx-gesture-sensor?course_id=31) you maybe want to check that out first, although it is not necessary at all. ### Hardware Needed For this lesson, *no actual hardware is needed*. However if you want to test out the completed demo application. You will need: - A Raspberry Pi 3 flashed with Android Things - A ZX Gesture Sensor If you need to buy the Raspberry Pi to start with Android Things I would recommend [this kit](https://shop.pimoroni.com/products/rainbow-hat-for-android-things). It contains: - Raspberry Pi 3 - Rainbow HAT - Pibow Coupé for Android Things - 2.5A official Raspberry Pi worldwide power supply - 8GB microSD card

Lessons in Introduction to Android Things