Jose Rios
/
Nucleo_Midi
Basic example for send MIDI messages
Diff: main.cpp
- Revision:
- 0:2f27565123e1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Sep 29 15:45:18 2014 +0000 @@ -0,0 +1,34 @@ +#include "mbed.h" +#include "midii.h" + +#define MIDI_SERIAL_TX PA_2 +#define MIDI_SERIAL_RX PA_3 + +MIDII midi(MIDI_SERIAL_TX, MIDI_SERIAL_RX); + +int main() +{ + while(1) + { + //Note 'D' in fifth octave on channel 1 at middle velocity (0x45) + midi.noteOn(CH_1, D, OCTAVE_5, 0x45); + wait(0.75); + midi.noteOff(CH_1, D, OCTAVE_5, 0x45); + wait(0.25); + + //Note 'E' in fifth octave on channel 1 at middle velocity (0x45) + midi.noteOn(CH_1, E, OCTAVE_5, 0x45); + wait(0.75); + midi.noteOff(CH_1, E, OCTAVE_5, 0x45); + wait(0.25); + + //Note 'G#' in fifth octave on channel 1 at middle velocity (0x45) + midi.noteOn(CH_1, G_, OCTAVE_5, 0x45); + wait(0.75); + midi.noteOff(CH_1, G, OCTAVE_5, 0x45); + wait(0.25); + + wait(3); + } +} + \ No newline at end of file