Arduino Quick Start
CoreInk sleep-wake related APIs and case programs.
#include <M5Unified.h> void setup(void){ auto cfg = M5.config(); M5.begin(cfg); M5.Display.setTextDatum(middle_center); M5.Display.setTextFont(&fonts::FreeSerifBold9pt7b); M5.Display.setTextSize(1); Serial.println("Press BtnPWR to sleep"); Serial.println("After 5s Wakeup"); M5.Display.drawString("Press BtnPWR", M5.Display.width() / 2, M5.Display.height() / 2 - 20); M5.Display.drawString("to Sleep 5s", M5.Display.width() / 2, M5.Display.height() / 2 + 20);} void loop(void){ M5.update(); if (M5.BtnPWR.wasPressed()) { M5.Display.clear(); M5.Display.drawString("Sleep 5s", M5.Display.width() / 2, M5.Display.height() / 2 + 20); M5.Power.timerSleep(5); // M5.Power.timerSleep(const rtc_time_t& time); // M5.Power.timerSleep(const rtc_date_t& date, const rtc_time_t& // time); // M5.Power.powerOff(); shutdown }}
The power supply part of CoreInk employs the Power_Class
in the M5Unified library. For more relevant APIs, you can refer to the document below: