from machine import Pin
from time import sleep
import dht
d = dht.DHT22(Pin(14))
led = Pin(16, Pin.OUT)
gas = Pin(27, Pin.IN)
buzz = Pin(17, Pin.OUT)
while True:
d.measure()
temp = d.temperature()
print("Temperature: ",temp,"° C.")
print("Humidity: ",d.humidity(),"%")
if temp >= 30:
led.on()
elif temp <= 25:
led.off()
buzz.value(abs(gas.value() - 1))
sleep(0.1)