from machine import Pin, ADC
from time import sleep
from math import log
sensor = ADC(Pin(33), atten=ADC.ATTN_11DB)
def lerTemp(s):
return 1 / (log(1 / (65535/s.read_u16() - 1)) / 3950 + 1.0 / 298.15) - 273.15
while True:
print (lerTemp(sensor))
sleep(1)