Arduino Guide
M5AtomS3 keystroke input related APIs and case programs.
AtomS3.update()
function in the main loop to read state updates and minimize blocking, otherwise the state of key changes may not be retrieved in time.#include "M5AtomS3.h"
void setup() {
AtomS3.begin();
}
void loop() {
AtomS3.update();
if (AtomS3.BtnA.wasPressed()) {
Serial.println("Pressed");
}
if (AtomS3.BtnA.wasReleased()) {
Serial.println("Released");
}
}
M5AtomS3 library is based on the M5Unified library implementation, the key part uses the Button_Class
in the M5Unified library, more key related API can refer to the following document: