mirror of
https://git.alemi.dev/cv-keyboard.git
synced 2024-11-12 20:09:21 +01:00
Added off counter but with value 0
This commit is contained in:
parent
54fc6f26ab
commit
3e477f4ca8
1 changed files with 13 additions and 6 deletions
|
@ -18,7 +18,7 @@
|
|||
#define Oct4 10
|
||||
|
||||
#define noteOffset 36
|
||||
#define offCounter 100
|
||||
#define offCounter 0
|
||||
|
||||
#include <MIDI.h>
|
||||
#include <HID.h>
|
||||
|
@ -60,12 +60,18 @@ void send() {
|
|||
for (int c = 48; c >= 0; c--) {
|
||||
if (flip[c] == HIGH) {
|
||||
flip[c] = LOW;
|
||||
noteBuffer = c + noteOffset;
|
||||
if (status[c] == HIGH) {
|
||||
MIDI.sendNoteOn(noteBuffer, velocity, 1);
|
||||
if (noteCounter[c] > 0) {
|
||||
noteCounter[c]--;
|
||||
}
|
||||
else if (status[c] == LOW) {
|
||||
MIDI.sendNoteOff(noteBuffer, velocity, 1);
|
||||
else {
|
||||
noteCounter[c] = offCounter;
|
||||
noteBuffer = c + noteOffset;
|
||||
if (status[c] == HIGH) {
|
||||
MIDI.sendNoteOn(noteBuffer, velocity, 1);
|
||||
}
|
||||
else if (status[c] == LOW) {
|
||||
MIDI.sendNoteOff(noteBuffer, velocity, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +79,7 @@ void send() {
|
|||
|
||||
void scan() {
|
||||
for (int cOctave = 0; cOctave < 4; cOctave++) {
|
||||
octBuffer = 12 * cOctave;
|
||||
digitalWrite(octave[cOctave], HIGH);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue