pdf-icon

Arduino Quick Start

AtomS3 Button

M5AtomS3 keystroke input related APIs and case programs.

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

Example

cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#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");
}
}

API

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:

On This Page