Skip to content

Commit 70b9e26

Browse files
committed
fixed compile error for boards that have no Serial
1 parent 596a1b0 commit 70b9e26

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

examples/CustomBaudRate/CustomBaudRate.ino

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ struct CustomBaudRate : public MIDI_NAMESPACE::DefaultSettings {
77
static const long BaudRate = 115200;
88
};
99

10-
MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial, MIDI, CustomBaudRate);
10+
#if defined(ARDUINO_SAM_DUE) || defined(USBCON) || defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__)
11+
// Leonardo, Due and other USB boards use Serial1 by default.
12+
MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial1, MIDI, CustomBaudRate);
13+
#else
14+
MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial, MIDI, CustomBaudRate);
15+
#endif
1116

1217
void setup() {
1318
pinMode(LED_BUILTIN, OUTPUT);

0 commit comments

Comments
 (0)