
Arduino Quick Start
NanoC6 Button related APIs and example program.
#include <M5NanoC6.h>
void setup() {
NanoC6.begin();
}
void loop() {
NanoC6.update();
if (NanoC6.BtnA.wasPressed()) {
Serial.println("Button A was pressed");
}
if (NanoC6.BtnA.wasHold()) {
Serial.println("Button A was hold");
}
if (NanoC6.BtnA.wasReleased()) {
Serial.println("Button A was released");
}
}This program detects the status of the front button on the NanoC6 and prints button events in the serial monitor:
The button section of NanoC6 refers to the Button_Class in the M5Unified library. For more button-related APIs, please refer to the documentation below: