An object that debounces a single GPIO.
More...
#include <Bounce3.h>
An object that debounces a single GPIO.
◆ Bounce3() [1/3]
Bounce3::Bounce3 |
( |
uint8_t |
pin, |
|
|
uint8_t |
mode, |
|
|
uint8_t |
pin_mode |
|
) |
| |
◆ Bounce3() [2/3]
Bounce3::Bounce3 |
( |
uint8_t |
pin, |
|
|
uint8_t |
mode |
|
) |
| |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
◆ Bounce3() [3/3]
Bounce3::Bounce3 |
( |
uint8_t |
pin | ) |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
◆ poll() [1/2]
bool Bounce3::poll |
( |
uint32_t |
ts, |
|
|
uint8_t |
val |
|
) |
| |
Update the button state.
- Parameters
-
ts | The timestamp to use. (default: millis()) |
val | The pin reading. (default: digitalRead(pin)) |
- Returns
- true, if the button state changes
◆ poll() [2/2]
bool Bounce3::poll |
( |
void |
| ) |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
◆ pressed()
uint8_t Bounce3::pressed |
( |
void |
| ) |
|
Check if the button was pressed this loop.
If the button was not pressed, the function returns zero. A non-zero value indicates the button was pressed, so you can evaluate it as a boolean.
If the instance is configured in one-shot mode, it will only return B3_PRESS once per debounced button press.
If the instance is configured in repeat mode, it will return B3_REPEAT_SLOW or B3_REPEAT_FAST to allow the code to differentiate between the first press and repeat presses (if desired).
- Returns
- 0 - Not pressed
-
B3_PRESS - Was just pressed
-
B3_REPEAT_SLOW - A virtual "press" on slow repeat
-
B3_REPEAT_FAST - A virtual "press" on fast repeat
◆ held()
bool Bounce3::held |
( |
void |
| ) |
|
- Returns
- true if the button is currently held down.
◆ heldFor() [1/2]
uint32_t Bounce3::heldFor |
( |
uint32_t |
millis | ) |
|
- Parameters
-
- Returns
- How long the button has been held down in ms
-
0, if the button is not currently presesd
◆ heldFor() [2/2]
uint32_t Bounce3::heldFor |
( |
void |
| ) |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
◆ released()
uint32_t Bounce3::released |
( |
void |
| ) |
|
- Returns
- The number of milliseconds the button was held down
-
or 0 if the button was not just released.
◆ changed()
bool Bounce3::changed |
( |
void |
| ) |
|
- Returns
- true if the button was just pressed or released
The documentation for this class was generated from the following files: