Raspberry Pi I2C

From Sketching with Hardware at LMU Wiki
Revision as of 14:22, 12 June 2024 by Mayersven (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

 1 import time
 2 import board
 3 import adafruit_tmp117
 4 
 5 i2c = board.I2C()  # uses board.SCL and board.SDA
 6 tmp117 = adafruit_tmp117.TMP117(i2c, 0x49) #A0 not connected --> 0x49
 7 
 8 while True:
 9     print("Temperature: %.2f degrees C"%tmp117.temperature)
10     time.sleep(1)