Skip to content

Button.h

andyp13 edited this page Sep 20, 2016 · 1 revision

#Button.h The Adafruit library code to use their button

##Initialization Input: (int pin) -> What pin the button is plugged into.

##Methods ###setup Description: Sets up the new button as a input.

###loop Description: Continuously checks the button pin to check whether or not it's status has changed. Also checks for noise in case the button was not actually pushed.

###isOn Description: Returns whether or not the button is low. Output: bool

###didPress Description: Returns if the button was pressed Output: bool

###didRelease Description: Returns if the button was released Output: bool

##Variables

Name Type View Description
_pin int Private Pin the button is plugged into
_buttonState int Private Current reading from the input pin
_lastButtonState int Private Previous reading from the input pin
_lastDebounceTime long Private Last time the output pin was toggled
_debounceDelay long Private The debounce time. Increase if the output flickers
_didPress bool Private Was the button just pressed
_didRelease bool Private Was the button just released

Clone this wiki locally