Added off counter but with value 0

This commit is contained in:
əlemi 2018-10-31 17:44:56 +01:00
parent 54fc6f26ab
commit 3e477f4ca8

View file

@ -18,7 +18,7 @@
#define Oct4 10 #define Oct4 10
#define noteOffset 36 #define noteOffset 36
#define offCounter 100 #define offCounter 0
#include <MIDI.h> #include <MIDI.h>
#include <HID.h> #include <HID.h>
@ -60,6 +60,11 @@ void send() {
for (int c = 48; c >= 0; c--) { for (int c = 48; c >= 0; c--) {
if (flip[c] == HIGH) { if (flip[c] == HIGH) {
flip[c] = LOW; flip[c] = LOW;
if (noteCounter[c] > 0) {
noteCounter[c]--;
}
else {
noteCounter[c] = offCounter;
noteBuffer = c + noteOffset; noteBuffer = c + noteOffset;
if (status[c] == HIGH) { if (status[c] == HIGH) {
MIDI.sendNoteOn(noteBuffer, velocity, 1); MIDI.sendNoteOn(noteBuffer, velocity, 1);
@ -69,10 +74,12 @@ void send() {
} }
} }
} }
}
} }
void scan() { void scan() {
for (int cOctave = 0; cOctave < 4; cOctave++) { for (int cOctave = 0; cOctave < 4; cOctave++) {
octBuffer = 12 * cOctave;
digitalWrite(octave[cOctave], HIGH); digitalWrite(octave[cOctave], HIGH);