#include <DHT.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
pinMode(3,OUTPUT);
Serial.begin(9600);
dht.begin();
lcd.init();
lcd.backlight();
}
void loop() {
delay(1000);
float h = dht.readHumidity();
float t = dht.readTemperature();
lcd.setCursor(0, 0);
lcd.print("TEMP: ");
lcd.print(t);
lcd.setCursor(0, 1);
lcd.print("HUMI: ");
lcd.print(h);
Serial.print("Humidity: ");
Serial.print(h, 1);
Serial.print("% Temperature: ");
Serial.print(t, 1);
Serial.print("C & ");
if (t>30){
digitalWrite(3,HIGH);
}
else{
digitalWrite(3,LOW);
}
}