fix printing/sleeping for dht

This commit is contained in:
Mathieu Maret 2019-05-14 21:03:28 +02:00
parent 43ad7977f6
commit 4fc32a30d8

View File

@ -70,14 +70,14 @@ int32_t channel = 11; //0 for Auto
ADC_MODE(ADC_VCC);
void setup()
{
Serial.begin(115200);
Serial.print("\nRunning\n");
#ifdef USE_DHT
// Power on DHT11
pinMode(DHT_POWER_PIN, OUTPUT);
digitalWrite(DHT_POWER_PIN, HIGH);
#endif
Serial.begin(115200);
Serial.print("\nRunning\n");
#ifdef USE_BME680
if (!bme.begin()) {
Serial.println("Could not find a valid BME680 sensor, check wiring!");
@ -222,6 +222,8 @@ int wifiConnect() {
int doDHTMeasure()
{
#ifdef USE_DHT
// Wait for DHT to be ready
delay(2000);
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
@ -265,8 +267,6 @@ int doDHTMeasure()
void loop()
{
// Wait for DHT to be ready
delay(2000);
doDHTMeasure();
doBMEMeasure();
ESP.deepSleep(SLEEP_TIME_SECOND * 1000000, WAKE_RF_DEFAULT);