#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#define DHTPIN 8
#define DHTTYPE DHT22
#define LEDPIN 7
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("System is Monitoring the Temperature...");
lcd.begin(16, 2);
dht.begin();
pinMode(LEDPIN, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
float temp = dht.readTemperature();
float humidity = dht.readHumidity();
delay(1000);
lcd.setCursor(0, 0);
lcd.println("temp. : ");
lcd.print(temp);
lcd.println(" C ");
lcd.setCursor(0, 1);
lcd.println("humi. :");
lcd.print(humidity);
lcd.println("%");
if (temp > 25) {
digitalWrite(LEDPIN, HIGH);
} else {
digitalWrite(LEDPIN, LOW);
}
}