Skip to content

Commit 611e9f8

Browse files
ensure serial is ready on ATMega32u4-based boards
1 parent b92436d commit 611e9f8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

examples/StandardFirmata/StandardFirmata.ino

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,16 @@ void setup()
677677
Firmata.attach(START_SYSEX, sysexCallback);
678678
Firmata.attach(SYSTEM_RESET, systemResetCallback);
679679

680+
// to use a port other than Serial, such as Serial1 on an Arduino Leonardo or Mega,
681+
// Call begin(baud) on the alternate serial port and pass it to Firmata to begin like this:
682+
// Serial1.begin(57600);
683+
// Firmata.begin(Serial1);
684+
// then comment out or remove lines 701 - 704 below
685+
680686
Firmata.begin(57600);
687+
while (!Serial) {
688+
; // wait for serial port to connect. Only needed for ATmega32u4-based boards (Leonardo, etc).
689+
}
681690
systemResetCallback(); // reset to default config
682691
}
683692

0 commit comments

Comments
 (0)