#include <DHT.h>
#include <Adafruit_Sensor.h>
#define DHTPIN 25
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(115200);
Serial.println("Hello, ESP32!");
dht.begin();
}
void loop() {
delay(1500);
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature();
if(isnan(h) || isnan(t) || isnan(f)){
Serial.println(F("Failed to read from DHT sensor!"));
return;
}
float hif = dht.computeHeatIndex(f , h);
float hic = dht.computeHeatIndex(t,h,false);
Serial.print(F("Humidity: "));
Serial.print(h);
Serial.print(F("% Temperature: "));
Serial.print(t);
Serial.print(F("Celsius "));
Serial.print(f);
Serial.print(F("Fahrenheit Heat Index: "));
Serial.print(hic);
Serial.print(F("Celsius "));
Serial.print(hif);
Serial.println(F("Fahrenheit"));
}