added CustomBaudRate example

- added customer baudrate example
- fixed old refs to examples in Doxygen
This commit is contained in:
lathoub 2022-01-11 07:07:27 +01:00
parent 8f8c7cfcc6
commit 596a1b0721
3 changed files with 33 additions and 6 deletions

View File

@ -23,6 +23,7 @@ jobs:
- Input
- RPN_NRPN
- SimpleSynth
- CustomBaudRate
board:
- uno
- due

View File

@ -12,7 +12,7 @@
// Examples
/*!
\example MIDI_Basic_IO.ino
\example Basic_IO.ino
This example shows how to perform simple input and output MIDI. \n
\n
When any message arrives to the Arduino, the LED is turned on,
@ -29,15 +29,15 @@
*/
/*!
\example MIDI_Callbacks.ino
\example Callbacks.ino
This example shows how to use callbacks for easier MIDI input handling. \n
*/
/*!
\example MIDI_Bench.ino
\example MIDI_DualMerger.ino
\example MIDI_Input.ino
\example MIDI_SimpleSynth.ino
\example Bench.ino
\example DualMerger.ino
\example Input.ino
\example SimpleSynth.ino
*/
// -----------------------------------------------------------------------------

View File

@ -0,0 +1,26 @@
#include <MIDI.h>
// Override the default MIDI baudrate to
// a decoding program such as Hairless MIDI (set baudrate to 115200)
struct CustomBaudRate : public MIDI_NAMESPACE::DefaultSettings {
static const long BaudRate = 115200;
};
MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial, MIDI, CustomBaudRate);
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
MIDI.begin(MIDI_CHANNEL_OMNI);
}
void loop() {
if (MIDI.read()) // If we have received a message
{
digitalWrite(LED_BUILTIN, HIGH);
MIDI.sendNoteOn(42, 127, 1); // Send a Note (pitch 42, velo 127 on channel 1)
delay(1000); // Wait for a second
MIDI.sendNoteOff(42, 0, 1); // Stop the note
digitalWrite(LED_BUILTIN, LOW);
}
}