football_project_wo_output
Fork of football_project by
DebounceIn Class Reference
DebounceIn adds mechanical switch debouncing to DigitialIn. More...
#include <DebounceIn.h>
Public Member Functions | |
void | start (int us=1000) |
start | |
int | read (void) |
read | |
operator int () | |
operator int() | |
DebounceIn (PinName pin, uint8_t nSamples=10) | |
Constructor. |
Detailed Description
DebounceIn adds mechanical switch debouncing to DigitialIn.
Example:
#include "mbed.h" #include "DebounceIn.h" DebounceIn d(p5); DigitialOut led1(LED1); DigitialOut led2(LED2); int main() { while(1) { led1 = d; led2 = d.read(); } }
Users of this library may also be interested in PinDetect library:-
This example shows one input displayed by two outputs. The input is debounced by the default 10ms.
Definition at line 55 of file DebounceIn.h.
Constructor & Destructor Documentation
DebounceIn | ( | PinName | pin, |
uint8_t | nSamples = 10 |
||
) |
Constructor.
- Parameters:
-
PinName pin The pin to assign as an input.
Definition at line 89 of file DebounceIn.h.
Member Function Documentation
operator int | ( | ) |
int read | ( | void | ) |
void start | ( | int | us = 1000 ) |
start
Sets the debounce sample period time in microseconds, default is 1000 (1ms)
- Parameters:
-
int i The debounce sample period time to set.
Definition at line 64 of file DebounceIn.h.
Generated on Mon Jul 18 2022 02:20:10 by 1.7.2