from machine import Pin,ADC
from utime import sleep
from math import log
BETA = 3950
sensor=ADC(Pin(27))
while(1):
nilai=sensor.read_u16() #to get reading in digital
voltage=nilai/65535*3.300 #get reading in voltage
print(nilai,voltage)
celsius = 1 / (log(1 / (65535.00 / nilai - 1)) / BETA + 1.0 / 298.15) - 273.15;
print("temperature",celsius,"^C")
sleep(0.3)