from dht import DHT22
from machine import Pin, SoftI2C
from utime import sleep
from i2c_lcd import I2cLcd
sda_pin = Pin(21)
scl_pin = Pin(22)
weather = DHT22(Pin(13))
i2c = SoftI2C(sda=sda_pin, scl=scl_pin, freq=10000)
device = 0x27
lcd = I2cLcd(i2c, device, 2, 16)
while True:
weather.measure()
temp = weather.temperature()
print('Temp: ',temp)
hum = weather.humidity()
print(f'Hum: {hum}')
lcd.putstr(f"{temp:6.2f}")
lcd.move_to(10,1)
lcd.putstr(f"{hum:6.2f}")
sleep(1)
lcd.clear()