#include "DHTesp.h" // Incluir librería
DHTesp dht; // Crear objeto dht
int dhtPin = 26; // Pin donde está conectado el sensor
int tipo=1;
float temp=0.0; // Variable para guardar la lectura de temperatura
#define L1 12
#define L2 13
#define L3 5
#define L4 23
#define L5 18
void setup()
{
dht.setup(dhtPin, DHTesp::DHT22);
pinMode(L1, OUTPUT);
pinMode(L2, OUTPUT);
pinMode(L3, OUTPUT);
pinMode(L4, OUTPUT);
pinMode(L5, OUTPUT);
digitalWrite(L1, LOW);
digitalWrite(L2, LOW);
digitalWrite(L3, LOW);
digitalWrite(L4, LOW);
digitalWrite(L5, LOW);
}
void loop() {
temp = dht.getTemperature();
  if (temp<=16.0) 
{
  digitalWrite(L1, LOW);
  digitalWrite(L2, LOW);
  digitalWrite(L3, LOW);
  digitalWrite(L4, LOW);
  digitalWrite(L5, LOW);
}
  if (temp>16.0 && temp<=18.0) 
{
  digitalWrite(L1, HIGH);
  digitalWrite(L2, LOW);
  digitalWrite(L3, LOW);
  digitalWrite(L4, LOW);
  digitalWrite(L5, LOW);
}
  if (temp>18.0 && temp<=20.0) 
{
  digitalWrite(L1, HIGH);
  digitalWrite(L2, HIGH);
  digitalWrite(L3, LOW);
  digitalWrite(L4, LOW);
  digitalWrite(L5, LOW);
}
  if (temp>20.0 && temp<=22.0) 
{
  digitalWrite(L1, HIGH);
  digitalWrite(L2, HIGH);
  digitalWrite(L3, HIGH);
  digitalWrite(L4, LOW);
  digitalWrite(L5, LOW);
}
  if (temp>22.0 && temp<=24.0) 
{
  digitalWrite(L1, HIGH);
  digitalWrite(L2, HIGH);
  digitalWrite(L3, HIGH);
  digitalWrite(L4, HIGH);
  digitalWrite(L5, LOW);
}
  if (temp>24.0) 
{
  digitalWrite(L1, HIGH);
  digitalWrite(L2, HIGH);
  digitalWrite(L3, HIGH);
  digitalWrite(L4, HIGH);
  digitalWrite(L5, HIGH);
  delay(250);
  digitalWrite(L5, LOW);
  delay(250);
}
}