I was trying to run the fan when when the temperature is between 20 and 40 With this and next the statement is to open pump when the temperature is above 40 and the humidity is less than 50.Now the problem my pump is not working
this is my code Can anyone help to come out of this. it would be great
#include <dht.h>
#define dht_apin A0 // Analog Pin sensor is connected to
dht DHT;
int led=7;
int Motor=11;
void setup(){
pinMode(dht_apin,INPUT);
Serial.begin(9600);
delay(500);//Delay to let system boot
Serial.println("DHT11 Humidity & temperature Sensor\n\n");
delay(1000);//Wait before accessing Sensor
pinMode(Motor,OUTPUT);
pinMode(led,OUTPUT);
}//end "setup()"
void loop(){
//Start of Program
int readData = DHT.read11(dht_apin); // Reads the data from the sensor
int t = DHT.temperature; // Gets the values of the temperature
int h = DHT.humidity; // Gets the values of the humidity
// Printing the results on the serial monitor
Serial.print("Temperature = ");
Serial.print(t);
Serial.print(" *C ");
Serial.print(" Humidity = ");
Serial.print(h);
Serial.println(" % ");
delay(5000);//Wait 5 seconds before accessing sensor again.
//Fastest should be once every two seconds.
if((15<t<40)or(50<h<85))
{
digitalWrite(led,HIGH);
digitalWrite(Motor,LOW);
delay(1000);
}
else if((t>30)&&(h<50))
{
digitalWrite(Motor,HIGH);
digitalWrite(led,LOW);
delay(1000);
}
else
{
digitalWrite(Motor,LOW);
digitalWrite(led,LOW);
delay(5000);
}
}