from machine import Pin
import time
import dht

led= Pin(4, Pin.OUT)
led1= Pin(15, Pin.OUT)
sensor= dht.DHT22(Pin(14))

while True:
  sensor.measure()
  t= sensor.temperature()
  h= sensor.humidity()
  if t>40:
    led.on()
  else:
    led.off()

  if h>50:
    led1.on()
  else:
    led1.off()

  time.sleep(2)