#include "DHT.h"
#include <LiquidCrystal_I2C.h>
#define DHTPIN 2
#define DHTTYPE DHT22
float h, t, f, hif, hic;
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 20, 4);
void setup(){
dht.begin();
lcd.init();
lcd.backlight();
lcd.setCursor(3,0);
lcd.print("BIANCONI FEDERICO");
lcd.setCursor(2,1);
lcd.print("Test Arduino!");
lcd.setCursor(0,2);
lcd.print("Arduino LCM IIC 2004");
lcd.setCursor(2,3);
lcd.print("Lettura DHT 22");
delay(1500);
}
void loop(){
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
float hif = dht.computeHeatIndex(f, h);
float hic = dht.computeHeatIndex(t, h, false);
lcd.setCursor(0,0);
lcd.print("Temp C ");
lcd.print(t);
lcd.setCursor(0,1);
lcd.print("Umidita' % ");
lcd.print(h);
delay(3000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("IC C-F ");
lcd.print(hic, 1);
lcd.print(" ");
lcd.print(hif, 1);
lcd.setCursor(0,1 );
lcd.print("Temp F ");
lcd.print(f);
delay(3000);
}