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