Real Time Lab Program

Dependencies:   USBDevice mbed

Files at this revision

API Documentation at this revision

Comitter:
robt
Date:
Sun Jan 25 16:32:00 2015 +0000
Commit message:
Real Time Lab Program

Changed in this revision

USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Sun Jan 25 16:32:00 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/USBDevice/#3b1c43ac045c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Jan 25 16:32:00 2015 +0000
@@ -0,0 +1,22 @@
+#include "mbed.h"
+#include "USBMIDI.h"
+
+USBMIDI midi;                        // initialise MIDI interface
+DigitalOut LED(p25);
+DigitalIn Switch(p14);
+AnalogIn Ain(p20);
+
+int main(){
+    while (1) {
+        if (Switch==1) {
+            int note = 48+72*Ain;                     // calculate note value
+            midi.write(MIDIMessage::NoteOn(note));    // note on
+            wait(0.2);
+            midi.write(MIDIMessage::NoteOff(note));    // note on
+            LED=0;
+        }
+        else {
+            LED=1;
+        }               
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Jan 25 16:32:00 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5
\ No newline at end of file