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


time.sleep(0.1) # Wait for USB to become ready
i2c = SoftI2C(sda=Pin(26),scl=Pin(21),freq=40000)
sensor = ADC(28)

devices = i2c.scan()
lcd = I2cLcd(i2c, devices[0] , 16 , 2)
lcd.clear()
button = Pin(10,Pin.IN)

check = True

def show(button):
    global check
    if check:
        lcd.clear()
        check=False
        return
    BETA = 3950;
    check = True
    analogValue = sensor.read_u16();
    celsius = 1 / (math.log(1 / (65535. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
    lcd.putstr(f"{celsius}")

button.irq(show, trigger=button.IRQ_FALLING)
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT