#include <DHT.h>
#include <LiquidCrystal.h>
#include <stdio.h>
#define rs 12
#define rw 11
#define en 10
#define d4 9
#define d5 8
#define d6 7
#define d7 6
#define DHTPIN 13
#define DHTTYPE DHT22
LiquidCrystal lcd(rs, rw, en, d4, d5, d6, d7);
DHT dht(DHTPIN, DHTTYPE);
char buf[16];
void setup() {
// put your setup code here, to run once:
lcd.begin(16,2);
dht.begin();
Serial.begin(115200);
delay(10);
lcd.clear();
}
void loop() {
// put your main code here, to run repeatedly:
float hum = dht.readHumidity();
float temp = dht.readTemperature();
float hic = dht.computeHeatIndex(temp, hum, false);
Serial.print("Temp : ");
Serial.print(temp);
Serial.print("°C Hum : ");
Serial.print(hum);
Serial.print("% Heat Index : ");
Serial.print(hic);
Serial.println("°C");
sprintf(buf, "Temp : %f 'C ", temp);
lcd.setCursor(0,0);
lcd.print(buf);
sprintf(buf, "Hum : %f %% ", hum);
lcd.setCursor(0,1);
lcd.print(buf);
delay(1000);
}