Rob Toulson
/
RealTimeLab06_MIDIoutput
Real Time Lab Program
main.cpp@0:8babbd3cdb4b, 2015-01-25 (annotated)
- Committer:
- robt
- Date:
- Sun Jan 25 16:29:02 2015 +0000
- Revision:
- 0:8babbd3cdb4b
Real Time Lab Program
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
robt | 0:8babbd3cdb4b | 1 | #include "mbed.h" |
robt | 0:8babbd3cdb4b | 2 | #include "USBMIDI.h" |
robt | 0:8babbd3cdb4b | 3 | |
robt | 0:8babbd3cdb4b | 4 | USBMIDI midi; // initialise MIDI interface |
robt | 0:8babbd3cdb4b | 5 | |
robt | 0:8babbd3cdb4b | 6 | int i; |
robt | 0:8babbd3cdb4b | 7 | |
robt | 0:8babbd3cdb4b | 8 | int main() { |
robt | 0:8babbd3cdb4b | 9 | while (1) { |
robt | 0:8babbd3cdb4b | 10 | for(i=48; i<72; i++) { // step through notes 48 to 120 |
robt | 0:8babbd3cdb4b | 11 | midi.write(MIDIMessage::NoteOn(i)); // note on |
robt | 0:8babbd3cdb4b | 12 | wait(0.2); // pause |
robt | 0:8babbd3cdb4b | 13 | midi.write(MIDIMessage::NoteOff(i)); // note off |
robt | 0:8babbd3cdb4b | 14 | wait(0.2); // pause |
robt | 0:8babbd3cdb4b | 15 | } |
robt | 0:8babbd3cdb4b | 16 | } |
robt | 0:8babbd3cdb4b | 17 | } |