from machine import Pin
import dht
import time
from machine import I2C
from lcd_api import LcdApi
from pico_i2c_lcd import I2cLcd
h = None
t = None
dhts=dht.DHT22(Pin((22)));dhts.measure();time.sleep(2)
I2C_ADDR = 0x27 # NOTE: Be sure to set address
lcdi2c=I2C(1, scl=Pin((27)), sda=Pin((26)), freq=400000)
lcd = I2cLcd(lcdi2c, I2C_ADDR, 2, 16)
lcd.clear()
lcd.putstr('Hello')
time.sleep(1)
while True:
dhts.measure()
h = dhts.temperature()
t = dhts.humidity()
lcd.clear()
lcd.move_to(0, 20)
lcd.putstr((''.join([str(x) for x in ['T:', t, ', H:', h]])))
print(''.join([str(x2) for x2 in ['T:', t, ', H:', h]]))
time.sleep(1)