Rob Toulson
/
RealTimeLab09_MIDIController
Real Time Lab Program
Revision 0:bf7edc68c57c, committed 2015-01-25
- Comitter:
- robt
- Date:
- Sun Jan 25 16:32:00 2015 +0000
- Commit message:
- Real Time Lab Program
Changed in this revision
--- /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