#include <DHT.h>
#define DHTPIN 14 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor
float humidity; //Stores humidity value
float temperature_c; // Stores Celcius temperature value
float temperature_f; // Store Fahrenheit temperature value
float hic; // Stores heat index for Celcius temperature value
float hif; // Stores heat index for Fahrenheit value
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
dht.begin();
}
void loop() {
// put your main code here, to run repeatedly:
humidity = dht.readHumidity(); // read the humidity
temperature_c = dht.readTemperature(); // read the temperature in celcius
temperature_f = (temperature_c * 9/5) + 32;
// Compute heat index of temperatures in celcius and fahrenheit
hif = dht.computeHeatIndex(temperature_f, humidity);
hic = dht.computeHeatIndex(temperature_c, humidity);
//Print temp and humidity values to serial monitor
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println("%");
Serial.print("Temperature C: ");
Serial.println(temperature_c);
Serial.print("Celsius");
Serial.print("Heat Index C: ");
Serial.println(hic);
Serial.print("Temperature F: ");
Serial.println(temperature_f);
Serial.print("Fahrenheit");
Serial.print("Heat Index F: ");
Serial.println(hif);
delay(10000);
}