Compare commits
1 Commits
f78e734a5a
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 70a41b3917 |
79
src/main.cpp
79
src/main.cpp
@@ -92,28 +92,30 @@ void loop() {
|
||||
if (digitalRead(B1_IN) == 0) {
|
||||
while (digitalRead(B1_IN) == 0) {
|
||||
|
||||
while (digitalRead(B2_IN) == 0) {} // Only execute remove point on button release.
|
||||
if (digitalRead(B2_IN) == 0) {
|
||||
while (digitalRead(B2_IN) == 0) {} // Only execute remove point on button release.
|
||||
|
||||
if (checkWin(score, 1) == 0) {
|
||||
removePoint(score, 1);
|
||||
displayOut[2] = setServeChar(servingChar, score, serving);
|
||||
game = true;
|
||||
}
|
||||
else {
|
||||
if (checkWin(score, 0) == 0) {}
|
||||
else {
|
||||
if (checkWin(score, 1) == 0) {
|
||||
removePoint(score, 1);
|
||||
|
||||
if (checkWin(score, 0) == 0) {
|
||||
displayOut[2] = servingChar;
|
||||
game = false;
|
||||
displayOut[2] = setServeChar(servingChar, score, serving);
|
||||
game = true;
|
||||
}
|
||||
else {}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (checkWin(score, 0) == 0) {}
|
||||
else {
|
||||
removePoint(score, 1);
|
||||
|
||||
setDisplay(score, &matrix, displayOut);
|
||||
delay(500); // to avoid calling twice.
|
||||
if (checkWin(score, 0) == 0) {
|
||||
displayOut[2] = servingChar;
|
||||
game = false;
|
||||
}
|
||||
else {}
|
||||
}
|
||||
}
|
||||
|
||||
setDisplay(score, &matrix, displayOut);
|
||||
delay(500); // to avoid calling twice.
|
||||
}
|
||||
|
||||
} // Only execute add point on button release. Point removal if other button is pressed during while loop.
|
||||
if (game == true) {
|
||||
@@ -135,28 +137,30 @@ void loop() {
|
||||
if (digitalRead(B2_IN) == 0) {
|
||||
while (digitalRead(B2_IN) == 0) {
|
||||
|
||||
while (digitalRead(B1_IN) == 0) {} // Only execute remove point on button release.
|
||||
if (digitalRead(B1_IN) == 0) {
|
||||
while (digitalRead(B1_IN) == 0) {} // Only execute remove point on button release.
|
||||
|
||||
if (checkWin(score, 0) == 0) {
|
||||
removePoint(score, 0);
|
||||
displayOut[2] = setServeChar(servingChar, score, serving);
|
||||
game = true;
|
||||
}
|
||||
else {
|
||||
if (checkWin(score, 1) == 0) {}
|
||||
else {
|
||||
if (checkWin(score, 0) == 0) {
|
||||
removePoint(score, 0);
|
||||
|
||||
if (checkWin(score, 1) == 0) {
|
||||
displayOut[2] = servingChar;
|
||||
game = false;
|
||||
displayOut[2] = setServeChar(servingChar, score, serving);
|
||||
game = true;
|
||||
}
|
||||
else {}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (checkWin(score, 1) == 0) {}
|
||||
else {
|
||||
removePoint(score, 0);
|
||||
|
||||
setDisplay(score, &matrix, displayOut);
|
||||
delay(500); // to avoid calling twice.
|
||||
if (checkWin(score, 1) == 0) {
|
||||
displayOut[2] = servingChar;
|
||||
game = false;
|
||||
}
|
||||
else {}
|
||||
}
|
||||
}
|
||||
|
||||
setDisplay(score, &matrix, displayOut);
|
||||
delay(500); // to avoid calling twice.
|
||||
}
|
||||
|
||||
} // Only execute add point on button release. Point removal if other button is pressed during while loop.
|
||||
if (game == true) {
|
||||
@@ -174,7 +178,7 @@ void loop() {
|
||||
delay(500); // to avoid calling twice
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// put function definitions here:
|
||||
@@ -196,4 +200,3 @@ void setDisplay(int* score, MD_Parola* matrix, char* displayOut) {
|
||||
matrix->print(displayOut);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user