Yuu Kobayashi
/
MIDITest
my midi test
Diff: main.cpp
- Revision:
- 0:4fc8ef3908b1
- Child:
- 1:a17d202e9a68
diff -r 000000000000 -r 4fc8ef3908b1 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Dec 28 12:04:32 2014 +0000 @@ -0,0 +1,43 @@ +#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); + } +}