Adafruit_Learning_System_Gu.../Introducing_CircuitPlaygroundExpress/CircuitPlaygroundExpress_Temperature.py
2018-05-15 15:04:28 +01:00

17 lines
429 B
Python

# CircuitPlaygroundExpress_Temperature
# reads the on-board temperature sensor and prints the value
import time
import adafruit_thermistor
import board
thermistor = adafruit_thermistor.Thermistor(
board.TEMPERATURE, 10000, 10000, 25, 3950)
while True:
temp_c = thermistor.temperature
temp_f = thermistor.temperature * 9 / 5 + 32
print("Temperature is: %f C and %f F" % (temp_c, temp_f))
time.sleep(0.25)