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 edit summary
 
Line 24: Line 24:
     time.sleep(1)
     time.sleep(1)
</syntaxhighlight>
</syntaxhighlight>
[[Category:Raspberry Pi]]

Latest revision as of 15:22, 12 June 2024

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[edit]

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)