Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of USBMIDI_HelloWorld by
Revision 0:4b55d56b6b61, committed 2011-02-20
- Comitter:
- simon
- Date:
- Sun Feb 20 13:15:46 2011 +0000
- Commit message:
Changed in this revision
diff -r 000000000000 -r 4b55d56b6b61 USBMIDI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBMIDI.lib Sun Feb 20 13:15:46 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/USBMIDI/#10d694d6ccdc
diff -r 000000000000 -r 4b55d56b6b61 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Feb 20 13:15:46 2011 +0000
@@ -0,0 +1,37 @@
+// 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);
+ }
+ }
+}
diff -r 000000000000 -r 4b55d56b6b61 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Feb 20 13:15:46 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e
