#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#define Type DHT22
int DHpin=2;
DHT DH(DHpin,Type);
float humidity;
float tempC;
float tempF;
int t=2000;
LiquidCrystal_I2C lcd(0x27,20,4);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
DH.begin();
lcd.begin(20,4);
lcd.backlight();
}
void loop() {
// put your main code here, to run repeatedly:
humidity=DH.readHumidity();
tempC=DH.readTemperature();
tempF=DH.readTemperature(true);
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(", Temperature C: ");
Serial.print(tempC);
Serial.print(", Temperature F: ");
Serial.print(tempF);
Serial.println();
delay(t);
lcd.setCursor(0,0);
lcd.print("DHT Readings");
lcd.setCursor(0,1);
lcd.print("Humidity: ");
lcd.print(humidity);
lcd.setCursor(0,2);
lcd.print("Temp C: ");
lcd.print(tempC);
lcd.setCursor(0,3);
lcd.print("Temp F: ");
lcd.print(tempF);
}