#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:
//Serial.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);
}