import time
import math
from machine import ADC, Pin, Timer, I2C, SoftI2C
from pico_i2c_lcd import I2cLcd

i2c=SoftI2C(sda=Pin(20),scl=Pin(19),freq=400000)
lcd_addr=i2c.scan()[0]
print(lcd_addr)

lcd=I2cLcd(i2c,lcd_addr,2,16)

led=Pin(1,Pin.OUT)

adc=ADC(Pin(26))
while True:
    temp=adc.read_u16()
    b=3950
    celcius=1/(math.log(1/(65535. / temp-1))/b+1.0/298.15)-273.15
    lcd.putstr(str(celcius)[:5])
    if celcius>40:
        led.on()
        time.sleep(1)
        led.off()
    
    time.sleep(2)
    lcd.clear()
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT