So in an attempt to read the current of my photon during sleep I did the following:
void setup()
{
Spark.sleep(10);
}
void loop() {
}
Once I uploaded this the LED showed white and I can’t download anything. I have since tried to hard reset with no luck. I’m hoping that I didn’t somehow -brick- the photon.
System.sleep(long seconds) does NOT stop the execution of user code (non-blocking call). User code will continue running while the Wi-Fi module is in standby mode.
Thanks @tjp. Actually, we were just discussing this internally today. Right now only Spark.sleep() works on the Core, and only System.sleep() works on the Photon. Sorry about that — shouldn’t be that way. We’ll be updating the docs soon to reflect reality, and an update to the Core firmware in the coming couple weeks will make System.sleep() work there.
And still cannot get the Photon to come out of sleep. @tjp, When you say that the code still runs, do you mean it is also looping through “void setup()” as well? I would assume that when it sleeps it continues to run the “void loop()” and then turns the WIFI back on? I’m getting the slow blinking white LED right now
@tgirard Sorry for obscuring the good advice of @Moors7 above — your current code will always immediately go to sleep, running setup() again each time it wakes up. Safe mode is the way to get your device back online so you can deliver an OTA firmware update with different code.
@Zachary, Thanks. I did use safe mode and was, in fact, able to get my photon back to a normal state
So the bigger question is how can I test System.sleep and simply have the photon sleep for a specified period of time and then come back to life without re-reading the System.sleep command upon waking?