3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License as published by
5
* the Free Software Foundation; either version 2 of the License, or
6
* (at your option) any later version.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
/* * * * * * * * * * * * * * * * * * * * * * * * * * * *
22
Main code by Thomas O Fredericks
23
Rebounce and duration functions contributed by Eric Lowry
24
Write function contributed by Jim Schimpf
25
risingEdge and fallingEdge contributed by Tom Harkaway
26
* * * * * * * * * * * * * * * * * * * * * * * * * * * * */
38
Bounce(uint8_t pin, unsigned long interval_millis );
39
// Sets the debounce interval
40
void interval(unsigned long interval_millis);
42
// Returns 1 if the state changed
43
// Returns 0 if the state did not change
45
// Forces the pin to signal a change (through update()) in X milliseconds
46
// even if the state does not actually change
47
// Example: press and hold a button and have it repeat every X milliseconds
48
void rebounce(unsigned long interval);
49
// Returns the updated pin state
51
// Sets the stored pin state
52
void write(int new_state);
53
// Returns the number of milliseconds the pin has been in the current state
54
unsigned long duration();
55
// The risingEdge method is true for one scan after the de-bounced
56
// input goes from off-to-on.
58
// The fallingEdge method it true for one scan after the
59
// de-bounced input goes from on-to-off.
64
unsigned long previous_millis, interval_millis, rebounce_millis;