This library supplies useful functions to manage button behavior on Arduino.
See an example project.
Include
#include <button_asukiaaa.h>
Define with gpio pin
#define PIN_BTN 10
button_asukiaaa::Button btn(PIN_BTN);
Call update in loop to check pin state
void loop() {
btn.update();
}
Call process on changed to release or press
if (btn.changedToPress()) {
// process on change to press
} else if (btn.changedToRelease()) {
// process on change to release
}
Call process by button state
if (btn.isPressing()) {
// process during pressed
} else { // btn.isReleasing()
// process during released
}
MIT