Hi all,
I am trying to do a very very simple loop to verify system.sleep with SLEEP_MODE_DEEP mode works the way I think it does. I am using an electron and using the Arduino monitor to see the COM3 port. Here is my code:
#include "SHT1x/SHT1x.h"
void setup()
{
Serial.begin(9600); // Open serial connection to report values to host
Serial.print("Start Cycle");
delay(5000);
}
void loop()
{
float temp_c;
float temp_f;
float humidity;
// Read values from the sensor
temp_c = sht1x.readTemperatureC();
temp_f = sht1x.readTemperatureF();
humidity = sht1x.readHumidity();
Serial.print(" Cycle ");
delay(5000);
System.sleep(SLEEP_MODE_DEEP, 300);
}
It works perfectly the first time, I get both the Start Cycle and the Cycle messages I expect. The electron then goes to sleep like its supposed to and wakes up 5 min later like it supposed to. But then nothing else on the COM port, and then the electron goes back to sleep for another 5 min. Since it HAS to see the Serial.print commands before going back to sleep and its obviously looping, the only thing I can think of the deep sleep messes up the COM port? Thanks for any help anyone can give!