diff --git a/README.md b/README.md index 8055a56..21dadd2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -# Experimental - # Arduino BLE-MIDI Transport This library implements the BLE-MIDI transport layer for the [FortySevenEffects Arduino MIDI Library](https://github.com/FortySevenEffects/arduino_midi_library) @@ -16,20 +14,54 @@ When manually installing this library, you have to manually download [Arduino MI #include #include ... -BLEMIDI_CREATE_DEFAULT_ESP32_INSTANCE(); +BLEMIDI_CREATE_DEFAULT_INSTANCE() ... void setup() { - MIDI.begin(1); + MIDI.begin(); ... void loop() { MIDI.read(); ``` -will create a instance named `bleMIDI` and listens to incoming MIDI on channel 1. +will create a instance named `BLEMIDI` and listens to incoming MIDI. + +### using NimBLE for ESP32 with a custom name and turns LED on when its connected + +```cpp +#include +#include +... +BLEMIDI_CREATE_INSTANCE("CustomName", MIDI) +... +void setup() +{ + pinMode(LED_BUILTIN, OUTPUT); + digitalWrite(LED_BUILTIN, LOW); + + BLEMIDI.setHandleConnected(OnConnected); + BLEMIDI.setHandleDisconnected(OnDisconnected); + + MIDI.begin(); +... +void loop() +{ + MIDI.read(); +... +void OnConnected() { + digitalWrite(LED_BUILTIN, HIGH); +} + +void OnDisconnected() { + digitalWrite(LED_BUILTIN, LOW); +} + +``` +will create a instance named `BLEMIDI` and listens to incoming MIDI. ## Tested boards/modules -- ESP32 +- ESP32 (OOB BLE and NimBLE) +- Arduino NANO 33 BLE ## Other Transport protocols: The libraries below the same calling mechanism (API), making it easy to interchange the transport layer.