see http://mbed.org/users/okini3939/notebook/midi/

Dependencies:   MIDI USBDevice mbed

Fork of MIDI_sample by Suga koubou

main.cpp

Committer:
okini3939
Date:
2012-12-03
Revision:
0:1a4d28e63bef
Child:
1:ecf5c3927710

File content as of revision 0:1a4d28e63bef:

#include "mbed.h"
#include "MIDI.h"

DigitalOut led1(LED1), led2(LED2);

MIDI midi(p9, p10);

int main() {
    midi.begin(4);    

    for (;;) {
        if (midi.read()) {
            led1 = 1;
            midi.sendNoteOn(42,127,1);  // Send a Note (pitch 42, velo 127 on channel 1)
            wait(1);
            midi.sendNoteOn(42,0,1);   // Stop the note
            led1 = 0;
        }
    }
}