Adafruit_Learning_System_Gu.../Introducing_CircuitPlaygroundExpress/CircuitPlaygroundExpress_Temperature.py
2019-09-11 17:33:59 -04:00

17 lines
423 B
Python

# Circuit Playground 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)