From 2bc2893f11aec15a8901716d9ce4de27c3fc064d Mon Sep 17 00:00:00 2001 From: Jeff Hoefs Date: Sat, 30 May 2015 20:55:36 -0700 Subject: [PATCH] wait for ATMega32u4 Serial port to connect. add not about using other Serial ports --- examples/StandardFirmata/StandardFirmata.ino | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/StandardFirmata/StandardFirmata.ino b/examples/StandardFirmata/StandardFirmata.ino index 384935b7..6c1aee0d 100644 --- a/examples/StandardFirmata/StandardFirmata.ino +++ b/examples/StandardFirmata/StandardFirmata.ino @@ -20,7 +20,7 @@ See file LICENSE.txt for further informations on licensing terms. - Last updated by Jeff Hoefs: May 17, 2015 + Last updated by Jeff Hoefs: May 30, 2015 */ #include @@ -692,7 +692,16 @@ void setup() Firmata.attach(START_SYSEX, sysexCallback); Firmata.attach(SYSTEM_RESET, systemResetCallback); + // to use a port other than Serial, such as Serial1 on an Arduino Leonardo or Mega, + // Call begin(baud) on the alternate serial port and pass it to Firmata to begin like this: + // Serial1.begin(57600); + // Firmata.begin(Serial1); + // then comment out or remove lines 701 - 704 below + Firmata.begin(57600); + while (!Serial) { + ; // wait for serial port to connect. Only needed for ATmega32u4-based boards (Leonardo, etc). + } systemResetCallback(); // reset to default config }