This library sets each button up as input_pullup by default, allowing you to wire the button to any digital input and ground. Input_pullup can be disabled by passing an optional flag to the constructor() and wiring the button with your own resistor.
Create a new button and pass in the Arduino pin number. This library will default to input_pullup and invert the button readings to simplify wiring for you. Pass in the second [optional] parameter as false to disable input_pullup.
Provide an unsigned long value greater than zero to set the debounce time in milliseconds. Most mechanical buttons will flip between on and off very quickly before settling in the correct state after being pressed or switched. Adjusting the debounce timeout will help remove these extra state-change events.
Flip the value of the raw button state reading so when the button isPressed() it will register as isReleased(), and vice versa. This method changes the behavior for onPressed() and onReleased() as well.
Returns true while the button is being pressed, or is on. Returns false while the button is not being pressed, or is off.
This method is good for real-time actions that must fire many times during a button press. Use the onPressed() event to fire only one action on each button press.
Returns true while the button is released, or is off. Returns false while the button is being pressed, or is on.
This method is good for real-time actions that must fire many times while the button is not pressed. Use the onReleased() event to fire only one action on each button release.
This will return true only once, after the button has been pressed (and debounced). The button must be released and then pressed again for this method to return true again.
This will return true only once, after the button has been released (and debounced). The button must be pressed and then released again for this method to return true again.