Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 731 Bytes

README.md

File metadata and controls

37 lines (26 loc) · 731 Bytes

mbed MIDI Adapter

Adapter for using the Arduino MIDI Library on mbed platforms

Usage

#include <mbed.h>
#include <MIDI.h> // v4.3 or superior, from GitHub FortySevenEffects/arduino_midi_library
#include <mbed-midi_Adapter.h>

// Create the adapter, connect to TX & RX pins
mbed_midi::Adapter gMbedMidiAdapter(PTE0, PTE1);

// Create the MIDI object using the adapter
MIDI_CREATE_INSTANCE(mbed_midi::Adapter, gMbedMidiAdapter, MIDI);

// Callbacks --

void handleNoteOn(byte channel, byte pitch, byte velocity)
{
    // todo: do something when a message is received.
}

// Main Entrypoint --

int main()
{
    MIDI.begin();
    MIDI.setHandleNoteOn(handleNoteOn);

    while (true) {
        MIDI.read();
    }
}