#include <Arduino.h>
#include <M5Unified.h>

void setup() {
  auto cfg = M5.config();
  M5.begin(cfg);
  M5.Display.setRotation(3);
  M5.Display.setTextScroll(true);
  M5.Display.setTextFont(1);
  M5.Display.println("started!!");
}

void loop() {
  M5.update(); // 各ボタンの状態を（読み取って）更新する：ボタンを判定するときは必須。

  if (M5.BtnA.wasReleasefor(1000) ) {
    M5.Display.println("[A] was Pressed longer than 1s");
  } else if (M5.BtnA.wasReleased()) {
    M5.Display.println("[A] was Pressed");
  } else if (M5.BtnB.wasReleasefor(1000) ) {
    M5.Display.println("[B] was Pressed longer than 1s");
  } else if (M5.BtnB.wasReleased()) {
    M5.Display.println("[B] was Pressed");
  } else if (M5.BtnPWR.wasReleased()) {
    M5.Display.println("[Pwr] was Pressed");
  }
  delay(10);
}