From d4067e7321b320b660efe1ae99bceddae76db959 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 May 2017 09:48:24 +0100 Subject: Fix wrong index for for loop --- src/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 5163508..6b84325 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,7 +32,7 @@ int main(void) wait(0.5); // Enable ISR for the switch rising edge - for (int i = 0; i < 3; ++i) { + for (int i = 0; i < 4; ++i) { switch_position[i] = new Counter(switch_pin[i]); } @@ -46,7 +46,7 @@ int main(void) oled.setTextCursor(0, 0); //Write the latest switch osciallor count - for (int i = 0; i < 3; ++i) { + for (int i = 0; i < 4; ++i) { oled.printf("\nS:%u C:%05u", switch_pressed[i], switch_count[i]); } @@ -65,7 +65,7 @@ int main(void) void tout(void) { // Query how many times switch triggered - for (int i = 0; i < 3; ++i) { + for (int i = 0; i < 4; ++i) { switch_count[i] = switch_position[i]->read(); switch_position[i]->write(0); -- cgit v1.2.3