from time import sleep
import dht
from machine import Pin
sensor = dht.DHT22(Pin(14)) #change the model while coding
blueLED = Pin(26,Pin.OUT)
redLED = Pin(22,Pin.OUT)
greenLED = Pin(21,Pin.OUT)
cyanLED = Pin(20,Pin.OUT)
while True:
sensor.measure()
Value_temp = sensor.temperature()
Value_humi = sensor.humidity()
print("Temperature",Value_temp,"Humidity",Value_humi)
redLED.off()
greenLED.off()
blueLED.off()
cyanLED.off()
if Value_temp > 37:
redLED.on()
print("Climate is warm")
elif Value_temp > 25:
greenLED.on()
print("Climate is moderate")
elif Value_temp > 10:
blueLED.on()
print("Climate is cool")
else:
cyanLED.on()
print("Climate is Freezing")