Arduino入門
#include <M5CoreS3.h> void setup(void) { auto cfg = M5.config(); CoreS3.begin(cfg); CoreS3.Display.setTextColor(GREEN); CoreS3.Display.setTextDatum(middle_center); CoreS3.Display.setFont(&fonts::FreeSerifItalic18pt7b); CoreS3.Display.setTextSize(1); CoreS3.Display.drawString("Touch", CoreS3.Display.width() / 2, CoreS3.Display.height() / 2 - 60); CoreS3.Display.drawString("to sleep", CoreS3.Display.width() / 2, CoreS3.Display.height() / 2 - 20); CoreS3.Display.drawString("After 5s", CoreS3.Display.width() / 2, CoreS3.Display.height() / 2 + 20); CoreS3.Display.drawString("Wakeup", CoreS3.Display.width() / 2, CoreS3.Display.height() / 2 + 60);} void loop(void) { CoreS3.update(); if (CoreS3.Touch.getCount() && CoreS3.Touch.getDetail(0).wasClicked()) { CoreS3.Power.timerSleep(5); // CoreS3.Power.timerSleep(const rtc_time_t& time); // CoreS3.Power.timerSleep(const rtc_date_t& date, const rtc_time_t& // time); // CoreS3.Power.powerOff(); shutdown }}
The M5CoreS3 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: