DHT11 | DHT22 |
---|---|
![]() |
![]() |
// ESP8266 note: use pins 3, 4, 5, 12, 13 or 14 --
// Pin 15 can work but DHT must be disconnected during program upload.
#include "DHT.h"
#define DHTPIN 4
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
float _Temp, _Hum, _TempRess;
void setup(){
Serial.begin(9600);
delay(500);//Delay to let system boot
Serial.println("DHT11/22 Humidity & temperature Sensor\n\n");
delay(1000);//Wait before accessing Sensor
}
void loop(){
delay(1000);
_Temp = dht.readTemperature();
_Hum = dht.readHumidity();
_TempRess = dht.computeHeatIndex(_Temp, _Hum, false);
Serial.print(F("Hum: "));
Serial.print(_Hum);
Serial.print(F("% Temp: "));
Serial.print(_Temp);
Serial.print(F("°C "));
Serial.print(F(" Temp Ressentie: "));
Serial.print(_TempRess);
Serial.println(F("°C "));
}