Raspberry Pi I2C: Difference between revisions

From Sketching with Hardware at LMU Wiki
Jump to navigation Jump to search
Created page with "TMP117 connected to the raspberry Pi 4 programmed in python 3 blue dot boards - https://www.bluedot.space/products/tmp117/ circuitpython library - https://circuitpython.rea..."
(No difference)

Revision as of 02:57, 4 January 2022

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)