-
Notifications
You must be signed in to change notification settings - Fork 6
/
misc.ino
37 lines (33 loc) · 836 Bytes
/
misc.ino
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
31
32
33
34
35
36
37
void switchRead() // between primary and auxiliary
{
input = digitalRead(switchPin);
}
void buttonRead() // reading button to change dispMode
{
static int buttonState, lastButtonState;
static long lastDebounceTime;
// debounce
int reading = digitalRead(buttonPin);
if(reading != lastButtonState) lastDebounceTime = millis();
if((millis() - lastDebounceTime) > DEBOUNCE_DELAY)
{
if (reading != buttonState)
{
buttonState = reading;
if(buttonState)
{
if(input == MAIN_IN) // on main input
{
mainDispMode ++;
if(mainDispMode > MAIN_MODES-1) mainDispMode = 0;
}
else // on auxiliary input
{
auxDispMode ++;
if(auxDispMode > AUX_MODES-1) auxDispMode = 0;
}
}
}
}
lastButtonState = reading;
}