Photon System.sleep(secs) practices

Hi All…

I am using the system.sleep(xxx) I like the method, however I want to know if there’s a way to force our way out of sleep… Say system.sleep(0); to halt out of sleep mode?? I’ve tried it but it didn’t work :smile:

Or should I manage the system mode semi automatically and wifi manually?

@frlobo, when the Photon sleeps, it’s not running code so you can’t “run” anything! You can wake using an interrupt or a timeout. :wink:

Hmm. Weird… I understood incorrectly from the documentation. I thought SLEEP_MODE_DEEP, did halt execution, but sleep only turns off WIFI radio to conserve energy.

As per Particle documentation:

System.sleep(long seconds) does NOT stop the execution of application code (non-blocking call). Application code will continue running while the Wi-Fi module is in standby mode.


System.sleep(SLEEP_MODE_DEEP, long seconds) can be used to put the entire device into a deep sleep mode. In this particular mode, the device shuts down the network subsystem and puts the microcontroller in a stand-by mode. When the device awakens from deep sleep, it will reset and run all user code from the beginning with no values being maintained in memory from before the deep sleep.


Am I understanding incorrectly… Or is there something missing?

@frlobo, maybe I should learn how to read posts thoroughly! Have you tried WiFi.on()?

LoL :blush:

No I haven’t … I think the sleep method is a bit goofy… It’s not behaving as expected, it goes to sleep for more than it should… So I am going to try semi automatic and WiFi control directly…

1 Like