Hi everyone
I got a problem designing of auto roofing system my goal is to you open the roof if temperature is high and rain is high no rain and temperature is low roof will close but I am unable to do the output and iam sharing the code can you help me to correct the code thank you
#include <dht.h>
dht DHT;
#define DHT11_PIN A1
int ldr=A2;
void setup() {
Serial.begin(9600);
pinMode(A0, INPUT);
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);
pinMode(10,OUTPUT);
}
void loop()
{
analogWrite(10,155);
int sensorVal = digitalRead(A0);
int chk = DHT.read11(DHT11_PIN);
Serial.print("Temperature = ");
Serial.println(DHT.temperature);
Serial.print("Humidity = ");
Serial.println(DHT.humidity);
if (sensorVal==1 || DHT.temperature<=34)
{
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
delay(5000);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
while(digitalRead(A0)==1);
while(DHT.temperature<=34);
}
if(sensorVal==0 || DHT.temperature>=35)
{
digitalWrite(11,HIGH);
digitalWrite(12,LOW);
delay(5000);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
while(digitalRead(A0)==0);
while(DHT.temperature>=35);
}
}