I intend to set limits on the temperature and humidity Arduino and dht11
I set limits temperature between 20-27 and humidity between 35-60
but when I try, the program does not work
I read on the device temp: 23 and humidity: 40
but are visible only "temperature under 20c ", which should be seen temp: 23 and humidity: 40
why like this? is there an error on my coding
this my code
#include <dht11.h>
#define dht_pin 2
int DHT_max = 27 ;
int DHT_min = 19 ;
int DHT_maxhum = 60 ;
int DHT_minhum = 35 ;
dht11 DHT;
void setup()
{
void temp(){
Serial.print("| humidity = ");
Serial.print(DHT.humidity);
Serial.print("% | ");
Serial.print("temp = ");
Serial.print(DHT.temperature);
Serial.println("C ");
}
void loop()
{
DHT.read(dht_pin);
if (DHT.temperature >= DHT_max)
{
Serial.println ("temperature over 27C");
}
else if (DHT.humidity>= DHT_min)
{
Serial.println ("temperature under 20C");
}
else if (DHT.humidity>= DHT_maxhum)
{
Serial.println ("humidity over 60C");
}
else if (DHT.humidity>= DHT_minhum)
{
Serial.println ("humidity under 35C");
}
else
{
temp();
}
delay(2000);
}
please help me....