An M5Stack library for displaying clock.
- Display clock charge
- Customize size and color
- Initialize your Platform IO project
- Install the library and its dependency
platformio init -d . -b m5stack-core-esp32
platformio lib install M5Clock
platformio lib install M5Unified
Warning This library has been tested only with M5Stack and M5StickC-PLUS.
#include <M5Unified.h>
#include <M5Clock.h>
const char* ssid = "ssid";
const char* password = "password";
M5Clock cl;
void setup() {
auto cfg = M5.config();
M5.begin(cfg);
M5.Display.setRotation(1);
cl.init(0, 0);
}
void loop() {
M5.update();
if (M5.BtnA.wasPressed()) {
if (cl.isDrawing()) {
cl.hide();
}
else {
cl.show();
}
}
if (M5.BtnB.wasPressed()) {
cl.syncClock(ssid, password);
}
delay(100);
}
You can also read the module doc for a list of supported calls.
Yushin Ito
MIT License