#include <Bounce2.h>
|
| Bounce () |
| Create an instance of the Bounce class. More...
|
|
void | attach (int pin, int mode) |
| Attach to a pin and sets that pin's mode (INPUT, INPUT_PULLUP or OUTPUT). More...
|
|
void | attach (int pin) |
|
void | interval (uint16_t interval_millis) |
| Sets the debounce interval in milliseconds. More...
|
|
bool | update () |
| Updates the pin's state. More...
|
|
bool | read () |
| Returns the pin's state (HIGH or LOW). More...
|
|
bool | fell () |
| Returns true if pin signal transitions from high to low.
|
|
bool | rose () |
| Returns true if pin signal transitions from low to high.
|
|
bool | risingEdge () |
| Deprecated (i.e. do not use). Included for partial compatibility for programs written with Bounce version 1.
|
|
bool | fallingEdge () |
| Deprecated (i.e. do not use). Included for partial compatibility for programs written with Bounce version 1.
|
|
| Bounce (uint8_t pin, unsigned long interval_millis) |
| Deprecated (i.e. do not use). Included for partial compatibility for programs written with Bounce version 1.
|
|
unsigned long | duration () |
| Returns the duration in milliseconds of the current state. More...
|
|
|
virtual bool | readCurrentState () |
|
virtual void | setPinMode (int pin, int mode) |
|
|
unsigned long | previous_millis |
|
uint16_t | interval_millis |
|
uint8_t | state |
|
uint8_t | pin |
|
unsigned long | stateChangeLastTime |
|
◆ Bounce()
Create an instance of the Bounce class.
◆ attach() [1/2]
void Bounce::attach |
( |
int |
pin, |
|
|
int |
mode |
|
) |
| |
Attach to a pin and sets that pin's mode (INPUT, INPUT_PULLUP or OUTPUT).
- Parameters
-
pin | The pin that is to be debounced. |
mode | A valid Arduino pin mode (INPUT, INPUT_PULLUP or OUTPUT). |
- Returns
- True if the event read was successful, otherwise false.
◆ attach() [2/2]
void Bounce::attach |
( |
int |
pin | ) |
|
Attach to a pin for advanced users. Only attach the pin this way once you have previously set it up. Otherwise use attach(int pin, int mode).
◆ duration()
unsigned long Bounce::duration |
( |
| ) |
|
Returns the duration in milliseconds of the current state.
Is reset to 0 once the pin rises ( rose() ) or falls ( fell() ).
- Returns
- The duration in milliseconds (unsigned long) of the current state.
◆ interval()
void Bounce::interval |
( |
uint16_t |
interval_millis | ) |
|
Sets the debounce interval in milliseconds.
- Parameters
-
interval_millis | The interval time in milliseconds. |
◆ read()
Returns the pin's state (HIGH or LOW).
- Returns
- HIGH or LOW.
◆ update()
Updates the pin's state.
Because Bounce does not use interrupts, you have to "update" the object before reading its value and it has to be done as often as possible (that means to include it in your loop()). Only call update() once per loop().
- Returns
- True if the pin changed state.
The documentation for this class was generated from the following files: