from machine import Pin
from time import sleep
from dht import DHT22
dht = DHT22(Pin(15))
dht2 = DHT22(Pin(14))
led = Pin(13, Pin.OUT)
while True:
dht.measure()
dht2.measure()
temp = dht.temperature()
hum = dht.humidity()
temp2 = dht2.temperature()
hum2 = dht2.humidity()
avgt = (temp+temp2)/2
avgh = (hum+hum2)/2
print(f"average temp {avgt}degree C and average humidity: {avgh}% ")
if avgt < 30:
led.toggle()
sleep(0.5)
else:
sleep(100000)