-->
Page 1 of 1

ESP8266 and DHT22 does not fit together ?

PostPosted: Tue Dec 08, 2015 3:34 am
by Gawan
Hi,

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:

Code: Select all#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