my midi test

Dependencies:   USBDevice mbed

main.cpp

Committer:
kb10uy
Date:
2014-12-28
Revision:
0:4fc8ef3908b1
Child:
1:a17d202e9a68

File content as of revision 0:4fc8ef3908b1:

#include "mbed.h"
#include "USBMIDI.h"

DigitalOut myled(LED1);
USBMIDI midi;

/*string str;*/
bool val = false;

void mm(MIDIMessage m) {
    //ostringstream os;
    /*
    switch(m.type()) {
        case MIDIMessage::NoteOnType:
            os << "note on ch" << m.channel() << " key" << m.key();
            break;
        case MIDIMessage::NoteOffType:
            os << "note off ch" << m.channel() << " key" << m.key();
            break;
        case MIDIMessage::ControlChangeType:
            os << "note ctrl chg ch" << m.channel() << " key" << m.key();
            break;
        case MIDIMessage::ProgramChangeType:
            os << "note prog chg ch" << m.channel() << " key" << m.key();
            break;
        case MIDIMessage::AllNotesOffType:
            os << "all notes off";
            break;
    }*/
    //str="received";//os.str();
    val=true;
}

int main() {
    midi.attach(&mm);
    while(1) {
        if (val) {
            val=!val;
            //printf("%s\r\n",/*str.c_str()*/);
        }
        wait_ms(1);
    }
}