-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added CustomBaudRate example - added customer baudrate example - fixed old refs to examples in Doxygen * fixed compile error for boards that have no Serial
- Loading branch information
Showing
3 changed files
with
38 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ jobs: | |
- Input | ||
- RPN_NRPN | ||
- SimpleSynth | ||
- CustomBaudRate | ||
board: | ||
- uno | ||
- due | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#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; | ||
}; | ||
|
||
#if defined(ARDUINO_SAM_DUE) || defined(USBCON) || defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__) | ||
// Leonardo, Due and other USB boards use Serial1 by default. | ||
MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial1, MIDI, CustomBaudRate); | ||
#else | ||
MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial, MIDI, CustomBaudRate); | ||
#endif | ||
|
||
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); | ||
} | ||
} |