#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd (0x27,20,4);
#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht (DHTPIN,DHTTYPE);
int led = 3;
void setup() {
lcd.init ();
lcd.backlight();
lcd.print ("MonitoringDHT22");
delay (2000);
pinMode(3,OUTPUT);
lcd.clear();
dht.begin();
}
void loop() {
float Temp = dht.readTemperature();
float Humidity = dht.readHumidity();
if (Temp<30){
digitalWrite(3, HIGH);
lcd.setCursor(0,0);
lcd.print ("Temp");
lcd.print(Temp);
lcd.print("C");
lcd.setCursor(8,1);
lcd.print("On");
}
if (Temp>30){
digitalWrite(3, LOW);
lcd.setCursor(0,0);
lcd.print ("Temp");
lcd.print(Temp);
lcd.print("C");
lcd.setCursor(8,1);
lcd.print("Of");
}
}