Arduino Guide
CoreInk Button input related APIs and case programs.
M5.update()
function in the main loop to read status update and minimize blocking, otherwise you may not be able to retrieve the status of key changes in time.#include "M5Unified.h"
void setup()
{
auto cfg = M5.config();
M5.begin(cfg);
Serial.begin(115200);
}
void loop()
{
M5.update();
if (M5.BtnA.wasPressed()) {
Serial.println("BtnA Pressed");
}
if (M5.BtnB.wasPressed()) {
Serial.println("BtnB Pressed");
}
if (M5.BtnC.wasPressed()) {
Serial.println("BtnC Pressed");
}
if (M5.BtnPWR.wasPressed()) {
Serial.println("BtnPWR Pressed");
}
if (M5.BtnEXT.wasPressed()) {
Serial.println("BtnEXT Pressed");
}
}
The button part of CoreInk uses the Button_Class
in the M5Unified library. For more APIs related to buttons, you can refer to the document below: