added NoteOff

This commit is contained in:
lathoub 2018-11-11 09:07:06 -05:00
parent 6cb35ccdea
commit 90410c60b8
1 changed files with 19 additions and 3 deletions

View File

@ -19,7 +19,7 @@ void setup()
bm.onDisconnected(OnBleMidiDisconnected);
bm.setHandleNoteOn(OnBleMidiNoteOn);
bm.setHandleNoteOff(OnBleMidiNoteOff);
Serial.println(F("looping"));
}
@ -29,7 +29,9 @@ void setup()
// -----------------------------------------------------------------------------
void loop()
{
bm.sendNoteOn(60, 127, 0);
bm.read();
//bm.sendNoteOn(60, 127, 0);
delay(1000);
}
@ -52,7 +54,7 @@ void OnBleMidiDisconnected() {
}
// -----------------------------------------------------------------------------
// rtpMIDI session. Device disconnected
// received note on
// -----------------------------------------------------------------------------
void OnBleMidiNoteOn(byte channel, byte note, byte velocity) {
Serial.print(F("Incoming NoteOn from channel:"));
@ -63,3 +65,17 @@ void OnBleMidiNoteOn(byte channel, byte note, byte velocity) {
Serial.print(velocity);
Serial.println();
}
// -----------------------------------------------------------------------------
// received note off
// -----------------------------------------------------------------------------
void OnBleMidiNoteOff(byte channel, byte note, byte velocity) {
Serial.print(F("Incoming NoteOff from channel:"));
Serial.print(channel);
Serial.print(F(" note:"));
Serial.print(note);
Serial.print(F(" velocity:"));
Serial.print(velocity);
Serial.println();
}