Button
Button copied to clipboard
A fork of Alexander Brevig's Button library for Arduino
These are the minimal changes to run the library on a recent Arduino version.
In Button.h: - unsigned int pressedStartTime; should be - unsigned **long** pressedStartTime; as millis() returns unsigned long
A button click event should only be fired when the button was not held. In Button.cpp ``` C++ if (cb_onClick) { cb_onClick(*this); } //fire the onClick event AFTER the onRelease...
I had to dig around in the .cpp file to figure out that a button is initialized via "Button button = Button(3, BUTTON_PULLDOWN)" rather than "Button button = Button(3, PULLDOWN)"...