diff --git a/deepSleep.ino b/deepSleep.ino index b7c8a3b..cf9162e 100644 --- a/deepSleep.ino +++ b/deepSleep.ino @@ -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);