import time
from machine import I2C, Pin
from pico_i2c_lcd import I2cLcd
from dht import DHT22
# LEONARDO RODRÍGUEZ
dht = DHT22(Pin(6))
i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
lcd = I2cLcd(i2c, i2c.scan()[0], 2, 16)
def mostrar_info(nombre, seccion):
lcd.clear()
lcd.putstr(nombre)
lcd.putstr(seccion)
time.sleep(5)
def mostrar_datos(temp, hum):
lcd.clear()
lcd.putstr(f"Temp: {temp}°C ")
lcd.putstr(f"Hum: {hum}% ")
print(f"Temperature: {temp}°C Humidity: {hum}%")
while True:
dht.measure()
temp = dht.temperature()
hum = dht.humidity()
mostrar_info("LeonardoRodríguez", "Seccion 202")
mostrar_datos(temp, hum)
time.sleep(4)