I have connected a DHT22 to my ESP8266 on GPIO2.
I learned that GPIO2 has to be accessed via pin = 4.
So this is (part of) my code:
#include <dht.h>
dht DHT;
#define DHT22_PIN1 4
void loop() {
delay(2000);
int chk1 = DHT.read22(DHT22_PIN1);
Serial.print("HUM: " + String(DHT.humidity));
Serial.print(",\t");
Serial.println("TEMP: " + String(DHT.temperature));
}
Unfortunately the output is always the same: HUM: -999.00, TEMP: -999.00
Any idea ?
BR
Gawan