From 198bbaf69e2ed4466f5a289b06396f7a6236ec12 Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 4 Mar 2019 18:56:20 +0100 Subject: [PATCH] Reordered code --- cvkeyboard.ino | 63 +++++++++++++++++++------------------------------- 1 file changed, 24 insertions(+), 39 deletions(-) diff --git a/cvkeyboard.ino b/cvkeyboard.ino index c911d53..66b8d09 100644 --- a/cvkeyboard.ino +++ b/cvkeyboard.ino @@ -67,26 +67,12 @@ void loop() { digitalWrite(octave[clock], HIGH); buff = scan(clock); digitalWrite(octave[clock], LOW); - //clean = clearOct(buff[0], buff[1], buff[2], buff[3], buff[4]); debug(buff); serialDebug(buff); } } -bool debouncedRead(int pin) { - if (digitalRead(pin) == HIGH) { - if (digitalRead(pin) == HIGH) { - if (digitalRead(pin) == HIGH) { - if (digitalRead(pin) == HIGH) { - if (digitalRead(pin) == HIGH) { - return HIGH; - } - } - } - } - } - return LOW; -} + octst scan(int nOct) { int c; octst output; @@ -95,22 +81,10 @@ octst scan(int nOct) { for (c = 0; c < 12; c++) { output.stat[c] = digitalRead(note[c]); - // delay(50); } return output; } -/*octst clearOct(octst o1, octst o2, octst o3, octst o4, octst o5) { - octst output; - - output.nOct = o1.nOct; - for (int c = 0; c < 12; +c++) { - if (o1.stat[c] && o2.stat[c] && o3.stat[c] && o4.stat[c] && o5.stat[c]) output.stat[c] = HIGH; - else output.stat[c] = LOW; - } - return output; -}*/ - void debug(octst input) { int c; for (c = 0; c < 12; c++) { @@ -129,17 +103,28 @@ void serialDebug(octst input) { Serial.println(""); } -/* debugLed(int c) { - switch (c) { - case 0: digitalWrite(2, HIGH); - break; - case 1: digitalWrite(3, HIGH); - break; - case 2: digitalWrite(4, HIGH); - break; - case 3: digitalWrite(2, LOW); - digitalWrite(3, LOW); - digitalWrite(4, LOW); - break; +bool debouncedRead(int pin) { + if (digitalRead(pin) == HIGH) { + if (digitalRead(pin) == HIGH) { + if (digitalRead(pin) == HIGH) { + if (digitalRead(pin) == HIGH) { + if (digitalRead(pin) == HIGH) { + return HIGH; + } + } + } + } + } + return LOW; +} + +/*octst clearOct(octst o1, octst o2, octst o3, octst o4, octst o5) { + octst output; + + output.nOct = o1.nOct; + for (int c = 0; c < 12; +c++) { + if (o1.stat[c] && o2.stat[c] && o3.stat[c] && o4.stat[c] && o5.stat[c]) output.stat[c] = HIGH; + else output.stat[c] = LOW; } + return output; }*/ \ No newline at end of file