from machine import Pin, SoftI2C
from dht import DHT22
from utime import sleep
from i2c_lcd import I2cLcd
from ssd1306 import SSD1306_I2C
weather = DHT22(Pin(13))
i2c = SoftI2C(sda=Pin(21), scl=Pin(22))
display = SSD1306_I2C(128, 64, i2c)
while True:
weather.measure()
temp = weather.temperature()
hum = weather.humidity()
print(f'Temp: {temp}')
print(f'Humi: {hum}')
display.fill(0)
display.text(f'Temp: {temp}C', 16, 16, 1)
display.text(f'Humi: {hum}%', 16, 42, 1)
display.show()
sleep(2)