from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
from dht import DHT22
WIDTH=128
HEIGHT=64
i2c=I2C(0)
oled= SSD1306_I2C(WIDTH,HEIGHT,i2c)
dht=DHT22(Pin(5))
while True:
dht.measure()
temp = dht.temperature()
hum = dht.humidity()
oled.fill(0)
oled.text("Temperatura:" ,5,5)
oled.text(str(temp) + " C",5,15)
oled.text("Humedad:",5,35)
oled.text(str(hum) + " %",5,45)
oled.show()