-
Notifications
You must be signed in to change notification settings - Fork 0
/
Button.h
30 lines (17 loc) · 839 Bytes
/
Button.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef _BUTTON_H_
#define _BUTTON_H_
#include <Arduino.h>
class Button{
public:
int buttonBoardPin = A0; // navigation button board pin
int buttonBoardOutput = 0; // navigation button board analogue output value
int buttonValue; // left button value
int buttonTolerance; // button tolerance (+/-)
int buttonState; // Current state of the button
int lastButtonState = LOW; // The last state of the button
unsigned long stateChangeTime = 0; // When the button changed state
unsigned long debounceDelay = 200; // debounce time
Button(int _value, int _tolerance);
bool buttonIsPressed();
};
#endif // _BUTTON_H_