From 90410c60b81acf83f8cd059a392368c211335b1c Mon Sep 17 00:00:00 2001 From: lathoub Date: Sun, 11 Nov 2018 09:07:06 -0500 Subject: [PATCH] added NoteOff --- .../Esp32_NoteOnOffEverySec.ino | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/examples/Esp32_NoteOnOffEverySec/Esp32_NoteOnOffEverySec.ino b/examples/Esp32_NoteOnOffEverySec/Esp32_NoteOnOffEverySec.ino index 62dfe6e..c607d2a 100644 --- a/examples/Esp32_NoteOnOffEverySec/Esp32_NoteOnOffEverySec.ino +++ b/examples/Esp32_NoteOnOffEverySec/Esp32_NoteOnOffEverySec.ino @@ -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(); +}