add plus button
This commit is contained in:
@@ -24,8 +24,8 @@ struct button {
|
||||
|
||||
struct arrow arrowTable[4];
|
||||
|
||||
#define ButtonTableLength 1
|
||||
struct button buttonTable[ButtonTableLength];
|
||||
struct button bButton;
|
||||
struct button plusButton;
|
||||
|
||||
void perms() {
|
||||
if(val == 0){
|
||||
@@ -60,12 +60,17 @@ void setup()
|
||||
MsTimer2::set(1, perms);
|
||||
MsTimer2::start();
|
||||
|
||||
buttonTable[0].pinNumber = 3;
|
||||
for (int i; i<ButtonTableLength; i++) {
|
||||
pinMode(buttonTable[i].pinNumber, INPUT_PULLUP);
|
||||
buttonTable[i].prev = 1;
|
||||
buttonTable[i].current = 1;
|
||||
}
|
||||
bButton.pinNumber = 3;
|
||||
pinMode(bButton.pinNumber, INPUT_PULLUP);
|
||||
bButton.prev = 1;
|
||||
bButton.current = 1;
|
||||
|
||||
plusButton.pinNumber = 15;
|
||||
pinMode(plusButton.pinNumber, INPUT_PULLUP);
|
||||
plusButton.prev = 1;
|
||||
plusButton.current = 1;
|
||||
|
||||
|
||||
|
||||
pinMode(2, INPUT_PULLUP);
|
||||
|
||||
@@ -95,19 +100,31 @@ void loop()
|
||||
}
|
||||
prevVal = val;
|
||||
|
||||
for (int i=0; i<ButtonTableLength; i++){
|
||||
buttonTable[i].current = digitalRead(buttonTable[i].pinNumber);
|
||||
|
||||
if(buttonTable[i].prev == 1 && buttonTable[i].current ==0 ){
|
||||
SwitchControlLibrary().PressButtonB();
|
||||
}
|
||||
else if(buttonTable[i].prev == 0 && buttonTable[i].current ==1 ) {
|
||||
SwitchControlLibrary().ReleaseButtonB();
|
||||
}
|
||||
|
||||
buttonTable[i].prev = buttonTable[i].current;
|
||||
bButton.current = digitalRead(bButton.pinNumber);
|
||||
|
||||
if(bButton.prev == 1 && bButton.current ==0 ){
|
||||
SwitchControlLibrary().PressButtonB();
|
||||
}
|
||||
else if(bButton.prev == 0 && bButton.current ==1 ) {
|
||||
SwitchControlLibrary().ReleaseButtonB();
|
||||
}
|
||||
|
||||
bButton.prev = bButton.current;
|
||||
|
||||
|
||||
|
||||
plusButton.current = digitalRead(plusButton.pinNumber);
|
||||
|
||||
if(plusButton.prev == 1 && plusButton.current ==0 ){
|
||||
SwitchControlLibrary().PressButtonPlus();
|
||||
}
|
||||
else if(plusButton.prev == 0 && plusButton.current ==1 ) {
|
||||
SwitchControlLibrary().ReleaseButtonPlus();
|
||||
}
|
||||
|
||||
plusButton.prev = plusButton.current;
|
||||
|
||||
|
||||
for (int i=0; i<4; i++){
|
||||
|
||||
Reference in New Issue
Block a user