import network
import time
from machine import Pin
import dht
import ujson
from umqtt.simple import MQTTClient
sensor = dht.DHT22(Pin(16))
led_red = Pin(13, Pin.OUT)
led_green = Pin(12, Pin.OUT)
led_red.off()
led_green.off()
while True:
sensor.measure()
t = sensor.temperature()
if t > 50:
led_green.on()
led_red.off()
elif t > 40:
led_red.on()
led_green.off()
else:
led_red.off()
led_green.off()
time.sleep(1)