#include <DHT.h>
#include <Servo.h>
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int pos1 = 0;
int pos2= 180;
Servo myservo;
#define DHTPIN 8
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
float alarm = 70;
int chk;
float hum;
void setup()
{
myservo.attach(9);
dht.begin();
Serial.begin(9600);
}
void loop()
{
hum = dht.readHumidity();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(hum);
//lcd.setCursor(0, 0);
//lcd.print(hum);
delay(1000);
if (hum >= alarm)
{
myservo.write(pos1);
delay(50);
}
else
{
myservo.write(pos2);
delay(50);
}
delay(1000);
}