Sleep mode of Electron device

I am trying to let Electron device go to sleep mode. Still have a question. If the Electron device goes to standard sleep mode (not deep sleep mode), does the device continue running code? What’s the difference between standard sleep mode and deep sleep mode?

Can I use the following function for this purpose?

System.sleep(uint16_t wakeUpPin, uint16_t edgeTriggerMode, long seconds,[SLEEP_NETWORK_STANDBY]); 


There is no such thing as standard sleep mode.

There are three modes

  • the one your command would enter, which is called Stop Mode for the STM32F controler and
  • deep sleep mode which would be Standby Mode by STM and finally
  • not really a sleep mode, but still triggered by System.sleep([timeout]), which just deactivates the radio module for <timeout> seconds

You can read up on the different modes here

Just substitute WiFi for cellular wherever the docs were not updated accordingly :wink:

If there are still questions open after reading this, we’ll be probably able to help out.

In deep sleep modes, when the Electron wakes up, the code resumes execution as if reset: it goes through normal initialization, setup() then loop() again.

In stop modes, the processor is stopped during sleep, but when it wakes up, execution continue at the line after the sleep call. Any variables will still be set after a stop mode sleep. The call you listed above is a stop mode sleep call.