Reordered code

This commit is contained in:
əlemi 2019-03-04 18:56:20 +01:00
parent 55ab943ecd
commit 198bbaf69e

View file

@ -67,26 +67,12 @@ void loop() {
digitalWrite(octave[clock], HIGH); digitalWrite(octave[clock], HIGH);
buff = scan(clock); buff = scan(clock);
digitalWrite(octave[clock], LOW); digitalWrite(octave[clock], LOW);
//clean = clearOct(buff[0], buff[1], buff[2], buff[3], buff[4]);
debug(buff); debug(buff);
serialDebug(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) { octst scan(int nOct) {
int c; int c;
octst output; octst output;
@ -95,22 +81,10 @@ octst scan(int nOct) {
for (c = 0; c < 12; c++) { for (c = 0; c < 12; c++) {
output.stat[c] = digitalRead(note[c]); output.stat[c] = digitalRead(note[c]);
// delay(50);
} }
return output; 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) { void debug(octst input) {
int c; int c;
for (c = 0; c < 12; c++) { for (c = 0; c < 12; c++) {
@ -129,17 +103,28 @@ void serialDebug(octst input) {
Serial.println(""); Serial.println("");
} }
/* debugLed(int c) { bool debouncedRead(int pin) {
switch (c) { if (digitalRead(pin) == HIGH) {
case 0: digitalWrite(2, HIGH); if (digitalRead(pin) == HIGH) {
break; if (digitalRead(pin) == HIGH) {
case 1: digitalWrite(3, HIGH); if (digitalRead(pin) == HIGH) {
break; if (digitalRead(pin) == HIGH) {
case 2: digitalWrite(4, HIGH); return HIGH;
break; }
case 3: digitalWrite(2, LOW); }
digitalWrite(3, LOW); }
digitalWrite(4, LOW); }
break; }
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;
}*/ }*/