Skip to content

yushin-ito/M5Clock

Repository files navigation

M5Clock


📝 Overview

An M5Stack library for displaying clock.

🚀 Features

  • Display clock charge
  • Customize size and color


📦 Installation



  1. Initialize your Platform IO project
  2. platformio init -d . -b m5stack-core-esp32
  3. Install the library and its dependency
  4. platformio lib install M5Clock
    platformio lib install M5Unified

🔧 Usage

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.


👀 Author

Yushin Ito

📜 License

MIT License