# uPython_06_temperature
# https://bhave.sh/micropython-measure-temperature/
from time import sleep
from machine import Pin, ADC
from math import log
BETA = 3950
KELVIN_CONSTANT = 273.15
def adc_to_celsius(x):
return (1 / (log(1/(65535/x - 1))/BETA + 1/298.15) - KELVIN_CONSTANT)
thermistor_pin = ADC(Pin(35))
while True:
thermistor_value = thermistor_pin.read_u16()
print(thermistor_value, round(adc_to_celsius(thermistor_value),1))
sleep(0.1)