コード例 #1
0
import time
import board
import busio
import adafruit_pct2075

i2c = busio.I2C(board.SCL, board.SDA)

pct = adafruit_pct2075.PCT2075(i2c)

while True:
    print("Temperature: %.2f C" % pct.temperature)
    time.sleep(0.5)
コード例 #2
0
def get_room_temp():
    i2c = busio.I2C(board.SCL, board.SDA)
    pct = adafruit_pct2075.PCT2075(i2c)
    celcius = pct.temperature
    farenheit = round((celcius * 1.8) + 32, 2)
    return farenheit