pdf-icon

Wakeup

M5Capsule sleep-wake related APIs and case programs.

Note:
The power cannot be turned off and hibernate under USB power supply condition. The function works only under battery power condition.
#include <M5Capsule.h>

void setup(void) {
    auto cfg = M5.config();
    M5Capsule.begin(cfg);

    Serial.println("Press Btn to sleep");
    Serial.println("After 5s Wakeup");
}

void loop(void) {
    M5Capsule.update();

    if (M5Capsule.BtnA.wasPressed()) {
        M5Capsule.Power.timerSleep(5);
        // M5Capsule.Power.timerSleep(const rtc_time_t& time);
        // M5Capsule.Power.timerSleep(const rtc_date_t& date, const rtc_time_t&
        // time);
        // M5Capsule.Power.powerOff(); shutdown
    }
}

API

The M5Capsule library is based on the M5Unified library implementation, the power supply part uses the Power_Class from the M5Unified library, for more related APIs you can refer to the following document:

On This Page