#include "DHT.h"
#include "LiquidCrystal_I2C.h"
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN,DHTTYPE );
LiquidCrystal_I2C lcd(0x27, 20, 4);
void setup() {
// put your setup code here, to run once:
//erial.begin(9600);
//Serial.println(F("DHTxx test!"));
dht.begin();
lcd.init();
lcd.backlight();
}
void loop() {
// put your main code here, to run repeatedly:
delay(2000);
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true );
if(isnan(h) || isnan (t) || isnan(f )) {
lcd.print(F("Failed to read from DHT sensor!"));
return ;
}
float hif = dht.computeHeatIndex (f,h);
float hic = dht.computeHeatIndex(t, h, false );
lcd.setCursor(0,0);
lcd.print(F("Humidity:"));
lcd.print(h);
lcd.setCursor(0,1);
lcd.print(F("Temperature:"));
lcd.print(t);
lcd.print(" ");
delay(100);
}