BLE MIDI TO UART MIDI

Dependencies:   BLE_API BufferedSerial mbed nRF51822

Fork of MIDI-to-BLE-MIDI-bridge by Samuele Cornell

Revision:
1:5cdcb9c72948
Parent:
0:244f1d0a3810
--- a/main.cpp	Tue Aug 09 12:57:23 2016 +0000
+++ b/main.cpp	Mon Jun 12 17:14:01 2017 +0000
@@ -62,7 +62,7 @@
 DigitalOut greenled(TX_LED); //
 #endif 
 
-
+Serial pc(USBTX, USBRX);
 /******************************************************************************************************************************
 *INITIALIZE VARIABLES, BUFFERS and BLE-MIDI Service and Characteristic
 ******************************************************************************************************************************/
@@ -335,7 +335,7 @@
 int main(void)
 {
 
-
+pc.baud(115200);
 #if LIGHT_SHOW==1
     redled = 1;
     greenled = 1;
@@ -392,9 +392,12 @@
 
 #if ONLY_BLEMIDI_to_MIDI==0    
             if(sendBLEMIDI_flag == true ) { // check if the flag is set 
+        uint8_t buf[TXRX_BUF_LEN];
+        uint16_t bytesRead;
+        ble.readCharacteristicValue(midiCharacteristic.getValueAttribute().getHandle(),
+                                    buf, &bytesRead);
+        pc.putc(buf[1]);
 
-            sendBLEMIDI_flag=false ;
-            sendBLEMIDI() ; // parse MIDI Events from UART and send them over BLE
 
         }
 #endif