Apologies if this is something that has already been asked or is a silly question.
I’m trying to get the Boron into sleep mode. I don’t care which one, I would just like for the RTC to still be on.
So far I’ve just called functions like System.sleep(SLEEP_MODE_DEEP, 5); System.sleep(SLEEP_MODE_SOFTPOWEROFF, 10); and System.sleep(SLEEP_MODE_DEEP, 30);
I can’t seem to wake the board back up. It stays in a breathing white indicator LED. I think my problem is that I don’t really understand how the sleep modes work, and how to call it in my code, so any help would be appreciated.
Neither of those commands will allow a wake with time on the Boron. Both are the equivalent of HIBERNATE sleep mode, and the RTC does not run in that mode so you can’t wake by time.
You should switch to using ULP sleep mode using the current API. Add a duration as well.
Also, you probably do not want to sleep with cellular off for less than 10 minutes, as your SIM may eventually get banned for aggressive reconnection.
int wakeInSeconds = secondsUntilNextEvent(); // Figure out how long to sleep
config.mode(SystemSleepMode::ULTRA_LOW_POWER)
.gpio(D2, FALLING)
.duration(wakeInSeconds* 1000L); // Set seconds until wake
// Ready to sleep
SystemSleepResult result = System.sleep(config); // Device sleeps here
if (result.wakeupPin() == D2) { // Woke by pin interrupt
// pin wake code here
}
else { // Woke by time
// time wake code here
}