Raspberry Pi I2C

From Sketching with Hardware at LMU Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

TMP117 connected to the raspberry Pi 4

programmed in python

3 blue dot boards - https://www.bluedot.space/products/tmp117/

circuitpython library - https://circuitpython.readthedocs.io/projects/tmp117/en/latest/


example code

Example code

import time
import board
import adafruit_tmp117

i2c = board.I2C()  # uses board.SCL and board.SDA
tmp117 = adafruit_tmp117.TMP117(i2c, 0x49) #A0 not connected --> 0x49

while True:
    print("Temperature: %.2f degrees C"%tmp117.temperature)
    time.sleep(1)