from machine import Pin
import time
import random
import dht
led = Pin(2, Pin.OUT)
capteur = dht.DHT22(Pin(15))
while True:
temperature = random.randint(20, 60)
print("Température :", temperature, "°C")
if temperature > 45:
led.on()
print("LED ON")
else:
led.off()
print("LED OFF")
time.sleep(2)