summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <wbe15@eews104a-006.ic.ac.uk>2017-05-04 09:48:24 +0100
committerVasil Zlatanov <v@skozl.com>2017-05-04 10:12:57 +0100
commitd4067e7321b320b660efe1ae99bceddae76db959 (patch)
tree2c4810dff3356580a014cf7b9828fe7131fcc1af
parent042622fa1b8e6841ce8c3aa03a565c6ce6243ccb (diff)
downloade2-switch-d4067e7321b320b660efe1ae99bceddae76db959.tar.gz
e2-switch-d4067e7321b320b660efe1ae99bceddae76db959.tar.bz2
e2-switch-d4067e7321b320b660efe1ae99bceddae76db959.zip
Fix wrong index for for loop
-rw-r--r--src/main.cpp6
1 files 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);