int threshold = 50;
#include <DHT.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(7,5,1,4,3,2);
#define DHTPIN 9
#define DATATYPE DHT22
DHT dht(DHTPIN,DATATYPE);
void setup() {
dht.begin();
lcd.begin(16,2);
pinMode(13,OUTPUT);
}
void loop() {
delay(1000);
float h = dht.readHumidity();
float t = dht.readTemperature();
lcd.setCursor(0,0);
lcd.print("Humidity:\t");
lcd.print(h);
lcd.print("%\n");
lcd.setCursor(0,1);
lcd.print("Temperature:\t");
lcd.print(t);
lcd.print("*\n");
if(t>=threshold){
digitalWrite(13,HIGH);
}
else{
digitalWrite(13,LOW);
}
}