We start by importing wiringpi2 so we can communicate with our I2C device later on. We will create a class to contain the required functionality to control the ADC. When we create the class, we can initialize wiringpi2 in such a way that it is ready to use the I2C bus (using wiringpi2.I2C()), and we will set up a generic I2C device with the chip's bus address (using self.i2c.setup(0x48)).
How it works...
Get Raspberry Pi 3 Cookbook for Python Programmers - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.