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.
Dependencies: mbed USBDevice PinDetect
Diff: main.cpp
- Revision:
- 0:cad8dafb22be
- Child:
- 2:e21bd39bdf46
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Apr 06 18:48:44 2016 +0000
@@ -0,0 +1,36 @@
+// Hello World example for the USBMIDI library
+
+#include "mbed.h"
+#include "USBMIDI.h"
+
+Serial pc(USBTX, USBRX);
+DigitalOut led(LED1);
+
+USBMIDI midi;
+
+void midiMessageReceived(MIDIMessage message) {
+ pc.printf("Message Received\r\n");
+ led = !led;
+
+ switch (message.type()) {
+ case MIDIMessage::NoteOnType:
+ pc.printf("\tType: Note On\r\n");
+ pc.printf("\tNote: %d\r\n", message.key());
+ break;
+ case MIDIMessage::NoteOffType:
+ pc.printf("\tType: Note Off\r\n");
+ break;
+ default:
+ pc.printf("\tType: Other\r\n");
+ }
+}
+
+int main() {
+ pc.printf("In Main\r\n");
+ midi.attach(midiMessageReceived);
+ led = 1;
+
+ while (1) {
+ }
+}
+
