Fixed missing curly brace (wouldn't compile)
Fixed bug where holding down button decreased score until 0
This commit is contained in:
@@ -92,6 +92,7 @@ void loop() {
|
|||||||
if (digitalRead(B1_IN) == 0) {
|
if (digitalRead(B1_IN) == 0) {
|
||||||
while (digitalRead(B1_IN) == 0) {
|
while (digitalRead(B1_IN) == 0) {
|
||||||
|
|
||||||
|
if (digitalRead(B2_IN) == 0) {
|
||||||
while (digitalRead(B2_IN) == 0) {} // Only execute remove point on button release.
|
while (digitalRead(B2_IN) == 0) {} // Only execute remove point on button release.
|
||||||
|
|
||||||
if (checkWin(score, 1) == 0) {
|
if (checkWin(score, 1) == 0) {
|
||||||
@@ -114,6 +115,7 @@ void loop() {
|
|||||||
|
|
||||||
setDisplay(score, &matrix, displayOut);
|
setDisplay(score, &matrix, displayOut);
|
||||||
delay(500); // to avoid calling twice.
|
delay(500); // to avoid calling twice.
|
||||||
|
}
|
||||||
|
|
||||||
} // Only execute add point on button release. Point removal if other button is pressed during while loop.
|
} // Only execute add point on button release. Point removal if other button is pressed during while loop.
|
||||||
if (game == true) {
|
if (game == true) {
|
||||||
@@ -135,6 +137,7 @@ void loop() {
|
|||||||
if (digitalRead(B2_IN) == 0) {
|
if (digitalRead(B2_IN) == 0) {
|
||||||
while (digitalRead(B2_IN) == 0) {
|
while (digitalRead(B2_IN) == 0) {
|
||||||
|
|
||||||
|
if (digitalRead(B1_IN) == 0) {
|
||||||
while (digitalRead(B1_IN) == 0) {} // Only execute remove point on button release.
|
while (digitalRead(B1_IN) == 0) {} // Only execute remove point on button release.
|
||||||
|
|
||||||
if (checkWin(score, 0) == 0) {
|
if (checkWin(score, 0) == 0) {
|
||||||
@@ -157,6 +160,7 @@ void loop() {
|
|||||||
|
|
||||||
setDisplay(score, &matrix, displayOut);
|
setDisplay(score, &matrix, displayOut);
|
||||||
delay(500); // to avoid calling twice.
|
delay(500); // to avoid calling twice.
|
||||||
|
}
|
||||||
|
|
||||||
} // Only execute add point on button release. Point removal if other button is pressed during while loop.
|
} // Only execute add point on button release. Point removal if other button is pressed during while loop.
|
||||||
if (game == true) {
|
if (game == true) {
|
||||||
@@ -174,7 +178,7 @@ void loop() {
|
|||||||
delay(500); // to avoid calling twice
|
delay(500); // to avoid calling twice
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// put function definitions here:
|
// put function definitions here:
|
||||||
@@ -196,4 +200,3 @@ void setDisplay(int* score, MD_Parola* matrix, char* displayOut) {
|
|||||||
matrix->print(displayOut);
|
matrix->print(displayOut);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user