pdf-icon

Arduino Quick Start

CoreInk Button

CoreInk Button input related APIs and case programs.

Note:
Include 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.

Example

cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
#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");
}
}

API

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:

On This Page