import time
from machine import I2C,SoftI2C,Pin, ADC
from pico_i2c_lcd import I2cLcd
import math
# freq 4000-5000 for banner type behaviour
i2c=SoftI2C(sda=Pin(1),scl=Pin(2),freq=500000)
lcd_address=i2c.scan()[0]
lcd = I2cLcd(i2c, lcd_address, 2, 16)
adc = ADC(26)
BETA=3950
while True:
temp=adc.read_u16()
celsius = 1 / (math.log(1 / (65535. / temp - 1)) / BETA + 1.0 / 298.15) - 273.15;
print(celsius)
lcd.clear()
lcd.putstr(str(round((celsius),2))+" *C")
time.sleep(5)
lcd.clear()
time.sleep(1)
lcd=I2cLcd(i2c,lcd_address,2,16)
lcd.putstr("Amitesh")