Rob Toulson
/
RealTimeLab09_MIDIController
Real Time Lab Program
main.cpp
- Committer:
- robt
- Date:
- 2015-01-25
- Revision:
- 0:bf7edc68c57c
File content as of revision 0:bf7edc68c57c:
#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; } } }