from microbit import *
from math import log
def tempconvert(reading):
Temp = log(10000.0*((1024.0/reading-1)))
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp )
Temp = Temp - 273.15 # Convert Kelvin to Celcius
return Temp
x=0
while True:
x = pin0.read_analog()
x = round(tempconvert(x),1)
display.scroll(str(x))
sleep(1000)