-
Notifications
You must be signed in to change notification settings - Fork 0
1. Using the Library
Caio Frota edited this page Mar 5, 2021
·
1 revision
-
Schematic

-
Include in your sketch.
#include <CFPushButton.h>- Initialize library.
#define PIN_PUSH_BUTTON D2
CFPushButton pushButton(PIN_PUSH_BUTTON);- Create a function for OnPressCallback
void onPressCallback() {
// Do something...
}- Also in the setup function add
void setup() {
// ... YOUR CODE ...
// Define callback.
pushButton..setOnPressCallback(onPressCallback);
// Start push button.
pushButton.begin();
// ... YOUR CODE ...
}- And in your loop function
void loop() {
// ... YOUR CODE ...
pushButton.loop();
// ... YOUR CODE ...
}