from machine import Pin
import time
import dht
led = Pin(5, Pin.OUT)
sensor = dht.DHT22(Pin(14))
'''
if the degree over 40C -> The light turns on
if the degree below 40C -> The light turns off
'''
while True:
sensor.measure() # read the parameters from the sensor
t = sensor.temperature()
if t > 40:
led.on()
else:
led.off()
time.sleep(1)