![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Real Time Lab Program
Diff: main.cpp
- Revision:
- 0:bf7edc68c57c
diff -r 000000000000 -r bf7edc68c57c main.cpp --- /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