I have a project using the NodeMCU-12E with ESP8266 and this reads temp and humidity from a DHT22 sensor.
The code works correctly, and when connected to the Mac I get serial output confirming the readings.
As I work towards reducing power consumption I have added a line to force the ESP8266 to deep sleep - the idea being that I only Tx the data once a minute.
It all works, but I do notice that if I look at the serial output, the first line of the two every minute has some garbage up front between the timestamp and the written output "Humidity" and then value.
So, I might get, for example, something like:
"14:20:03 ?.%???Humidity 45%
14:20:03 Temperature 20.0 C"
The second line with the Temperature reading has no garbage. Happens EVERY first line.
Am I right that this is unavoidable - due to booting up as a result of my deep sleep command?
It does not appear to affect the data sent to Blynk - but can I ask if it may well in fact do so?
This is my loop code. The garbage ONLY occurs when I include the ESP.deepSleep line.
My first project, so apologies if I have made any mistakes posting...
void loop()
{
Blynk.run(); // Initiates Blynk
timer.run(); // Initiates the timer
sendSensor(); // Pulls data from DHT sensor
// The following serial code allows you to ensure that you are getting valid readings which can be checked when connected via USB
Serial.print("Humidity: ");
Serial.print(String(h).c_str());
Serial.println(" %");
Serial.print("Temperature: ");
Serial.print(String(t).c_str());
Serial.println(" C");
// REMEMBER to set any 'offline alerts' in Blynk Projects to EXCEED the read time delay
ESP.deepSleep(60e6); // DEEP SLEEP for 60 seconds
}