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