Now we are ready to start acquiring data from I2C sensors. Usually, in order to use an I2C peripheral, we need a driver. A driver is a set of classes that handle the communication between the Android Things board and the peripheral. Moreover, these classes handle the specific protocols implemented by the peripheral. We will describe how to implement a low-level protocol in the next sections. By now, we can use a pre-built driver that is a library we have to include in our project. All the drivers officially supported by Android Things are available at GitHub under the folder contrib-drivers at https://github.com/androidthings/contrib-drivers.
Let us start:
- Create a new Android Things project by cloning the repository as described in the first chapter.
- Open build.gradle and add the following line under the dependencies:
compile 'com.google.android...