pdf-icon

Button

M5Dial button input related APIs and case programs.

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

#include "M5Dial.h"

void setup() {
    auto cfg = M5.config();
    M5Dial.begin(cfg, true, false);
}

void loop() {
    M5Dial.update();
    if (M5Dial.BtnA.wasPressed()) {
        Serial.println("A Btn Pressed");

    }
    if (M5Dial.BtnA.wasReleased()) {
        Serial.println("A Btn Released");
    }
}

API

M5Dial library is based on the M5Unified library, the key part uses the Button_Class in the M5Unified library, for more key related APIs you can refer to the following document:

On This Page