from machine import Pin, ADC, PWM
from time import sleep_ms
from math import log
ntc = ADC(Pin(26))
pot = ADC(Pin(28))
led = PWM(Pin(2))
led.freq(4000)
while True:
r1 = ntc.read_u16()
r2 = input("Type a value from 0 to 65535: ")
led.duty_u16(int(r2))
celsius = 1 / (log(1 / (65535. / r1 - 1)) / 3950 + 1.0 / 298.15) - 273.15
#print(f"Temp: {round(celsius, 1)} C")
sleep_ms(1)