Digigurdy-baz
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
GurdyButton Class Reference

#include <gurdybutton.h>

Inheritance diagram for GurdyButton:
KeyboxButton ToggleButton ExButton

Public Member Functions

 GurdyButton (int my_pin, int interval)
 Constructor. This class handles simple push-on, release-off buttons. More...
 
void update ()
 Polls the button and updates its state. More...
 
bool beingPressed ()
 Reports if the button is being pressed this update() cycle. More...
 
bool wasPressed ()
 Reports if the button was pressed down this update() cycle. More...
 
bool wasReleased ()
 Reports if the button was released this update() cycle. More...
 

Protected Attributes

Bounce * bounce_obj
 
bool being_pressed
 

Constructor & Destructor Documentation

◆ GurdyButton()

GurdyButton::GurdyButton ( int  my_pin,
int  interval 
)

Constructor. This class handles simple push-on, release-off buttons.

Parameters
my_pinThe digital pin this button is connected to
intervalThe debounce interval for this button

This class assumes the button is wired up as an active-low button. It applies the internal pullup resistor.

Member Function Documentation

◆ beingPressed()

bool GurdyButton::beingPressed ( )

Reports if the button is being pressed this update() cycle.

Returns
True if button is actve, false otherwise.

◆ update()

void GurdyButton::update ( )

Polls the button and updates its state.

This should be run every loop() even if the results are not used.

◆ wasPressed()

bool GurdyButton::wasPressed ( )

Reports if the button was pressed down this update() cycle.

Returns
True if button was just pressed down, false otherwise.

◆ wasReleased()

bool GurdyButton::wasReleased ( )

Reports if the button was released this update() cycle.

Returns
True if button was just released, false otherwise.

Member Data Documentation

◆ being_pressed

bool GurdyButton::being_pressed
protected

◆ bounce_obj

Bounce* GurdyButton::bounce_obj
protected

The documentation for this class was generated from the following files: