Framed Laser Harp Implementation with MBed, that allows interface with MIDI synthesizers software.
Fork of LaserHarpProj by
main.cpp
- Committer:
- simon
- Date:
- 2011-02-20
- Revision:
- 0:4b55d56b6b61
- Child:
- 1:2b551cb862fe
File content as of revision 0:4b55d56b6b61:
// Hello World example for the USBMIDI library #include "mbed.h" #include "USBMIDI.h" void show_message(MIDIMessage msg) { switch (msg.type()) { case MIDIMessage::NoteOnType: printf("NoteOn key:%d, velocity: %d, channel: %d\n", msg.key(), msg.velocity(), msg.channel()); break; case MIDIMessage::NoteOffType: printf("NoteOff key:%d, velocity: %d, channel: %d\n", msg.key(), msg.velocity(), msg.channel()); break; case MIDIMessage::ControlChangeType: printf("ControlChange controller: %d, data: %d\n", msg.controller(), msg.value()); break; case MIDIMessage::PitchWheelType: printf("PitchWheel channel: %d, pitch: %d\n", msg.channel(), msg.pitch()); break; default: printf("Another message\n"); } } USBMIDI midi; int main() { midi.attach(show_message); // call back for messages received while (1) { for(int i=48; i<83; i++) { // send some messages! midi.write(MIDIMessage::NoteOn(i)); wait(0.25); midi.write(MIDIMessage::NoteOff(i)); wait(0.5); } } }