sleep() [ Sleep ]
SystemSleepConfiguration config; config.mode(SystemSleepMode::STOP) .gpio(D2, RISING); SystemSleepResult result = System.sleep(config);
System.sleep() can be used to dramatically improve the battery life of a Particle-powered project.
For introduction to sleep and the various sleep modes and trade-offs, see Learn more about sleep modes.
SystemSleepConfiguration class configures all of the sleep parameters and eliminates the previous numerous and confusing overloads of the
System.sleep() function. You pass this object to
For earlier versions of Device OS you can use the classic API.
The Tracker One and Tracker SoM have an additional layer of sleep functionality. You can find out more in the Tracker Sleep Tutorial and TrackerSleep API Reference. You generally should avoid directly using this sleep API on the Tracker as it will not put the tracker-specific peripherals like the GNSS, IMU, CAN, and RTC to sleep properly, as these functions are implemented in the Tracker Edge sleep functionality, not Device OS.