#Harjoitus 4 Juho Lehtonen
from machine import Pin
import dht
import time
sensor = dht.DHT22(Pin(16))
led = Pin(15, Pin.OUT)
RAJA = 20
while True:
sensor.measure()
temp = sensor.temperature()
hum = sensor.humidity()
print("Lämpötila:", temp, "°C | Kosteus:", hum, "%")
if temp > RAJA:
led.value(1) # LED ON
else:
led.value(0) # LED OFF
time.sleep(2)