ESP12E with DHT22
Posted: Sun Feb 21, 2016 10:47 am
Hi
I try to use esp12e (not node mcu) with DHT22. This is my setup :
GND -> GND
GPIO15 -> 10k + GND
GPIO2 -> DHT DATA
GPIO0 -> 10k + 3.3V
RST -> 10k + 3.3V
EN -> 10k + 3.3V
VCC-> 3.3V
And my code :
This code works well with my esp01 but with esp12e i can't read the DHT, i always have "Failed to read from DHT sensor!
".
I try every pin but can't get the temp, always this message or nothing at all.
Maybe i miss something ?
Thank
I try to use esp12e (not node mcu) with DHT22. This is my setup :
GND -> GND
GPIO15 -> 10k + GND
GPIO2 -> DHT DATA
GPIO0 -> 10k + 3.3V
RST -> 10k + 3.3V
EN -> 10k + 3.3V
VCC-> 3.3V
And my code :
Code: Select all
#include "DHT.h"
#define DHTPIN 2 // what digital pin we're connected to
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
char str_humi[6];
char str_temp[6];
int interval;
char piece[11];
void setup() {
Serial.begin(9600);
Serial.println("DHTxx test!");
dht.begin();
}
void loop() {
// Wait a few seconds between measurements.
delay(2000);
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
dtostrf(t, 4, 2, str_temp);
dtostrf(h, 4, 2, str_humi);
Serial.println(str_temp);
}
This code works well with my esp01 but with esp12e i can't read the DHT, i always have "Failed to read from DHT sensor!
".
I try every pin but can't get the temp, always this message or nothing at all.
Maybe i miss something ?
Thank