Reader small image

You're reading from  Practical Python Programming for IoT

Product typeBook
Published inNov 2020
Reading LevelIntermediate
PublisherPackt
ISBN-139781838982461
Edition1st Edition
Languages
Right arrow

ADS1115 setup and configuration

At line (2) in the following code block, we use the busio import to create an I2C interface with Circuit Python/Blika. The board.SLC and board.SDA parameters indicate we are using the dedicated I2C channel (alternative functions of GPIO 2 and 3) on the Raspberry Pi:

# Create the I2C bus & ADS object.
i2c = busio.I2C(board.SCL, board.SDA) # (2)
ads = ADS.ADS1115(i2c)

Next, we create an instance of ADS.ADS1115 using the pre-configured I2C interface and assign it to the ads variable. From this point forward in the code, when we interact with our ADS1115 module, we will use this instance.

Next, let's consider the global variables.

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Practical Python Programming for IoT
Published in: Nov 2020Publisher: PacktISBN-13: 9781838982461