From c009ac6e4c03d987b56bf936c28c9e73264531a4 Mon Sep 17 00:00:00 2001 From: agdl Date: Fri, 27 Nov 2015 14:35:01 +0100 Subject: [PATCH 1/2] Modified example to not generate confusion Only Arduino Mega was mentioned, but actually many boards have more than one Serial port --- .../MultiSerial/MultiSerial.ino | 42 +++++++++++++++++++ .../MultiSerial/MultiSerial.txt | 1 + 2 files changed, 43 insertions(+) create mode 100644 build/shared/examples/04.Communication/MultiSerial/MultiSerial.ino create mode 100644 build/shared/examples/04.Communication/MultiSerial/MultiSerial.txt diff --git a/build/shared/examples/04.Communication/MultiSerial/MultiSerial.ino b/build/shared/examples/04.Communication/MultiSerial/MultiSerial.ino new file mode 100644 index 00000000000..ea9fa2eb212 --- /dev/null +++ b/build/shared/examples/04.Communication/MultiSerial/MultiSerial.ino @@ -0,0 +1,42 @@ +/* + Multple Serial test + + Receives from the main serial port, sends to the others. + Receives from serial port 1, sends to the main serial (Serial 0). + + This example works only with boards with more than one serial like Arduino Mega, Due, Zero etc + + The circuit: + * Any serial device attached to Serial port 1 + * Serial monitor open on Serial port 0: + + created 30 Dec. 2008 + modified 20 May 2012 + by Tom Igoe & Jed Roach + modified 27 Nov 2015 + by Arturo Guadalupi + + This example code is in the public domain. + + */ + + +void setup() { + // initialize both serial ports: + Serial.begin(9600); + Serial1.begin(9600); +} + +void loop() { + // read from port 1, send to port 0: + if (Serial1.available()) { + int inByte = Serial1.read(); + Serial.write(inByte); + } + + // read from port 0, send to port 1: + if (Serial.available()) { + int inByte = Serial.read(); + Serial1.write(inByte); + } +} diff --git a/build/shared/examples/04.Communication/MultiSerial/MultiSerial.txt b/build/shared/examples/04.Communication/MultiSerial/MultiSerial.txt new file mode 100644 index 00000000000..39f321bf950 --- /dev/null +++ b/build/shared/examples/04.Communication/MultiSerial/MultiSerial.txt @@ -0,0 +1 @@ +Use two of the serial ports available on the Arduino board. From 53af4a7dea3d676ee717122dda3d2522f71a2bc3 Mon Sep 17 00:00:00 2001 From: agdl Date: Fri, 27 Nov 2015 14:40:31 +0100 Subject: [PATCH 2/2] Removed old example --- .../MultiSerialMega/MultiSerialMega.ino | 40 ------------------- .../MultiSerialMega/MultiSerialMega.txt | 1 - 2 files changed, 41 deletions(-) delete mode 100644 build/shared/examples/04.Communication/MultiSerialMega/MultiSerialMega.ino delete mode 100644 build/shared/examples/04.Communication/MultiSerialMega/MultiSerialMega.txt diff --git a/build/shared/examples/04.Communication/MultiSerialMega/MultiSerialMega.ino b/build/shared/examples/04.Communication/MultiSerialMega/MultiSerialMega.ino deleted file mode 100644 index 54e31549b97..00000000000 --- a/build/shared/examples/04.Communication/MultiSerialMega/MultiSerialMega.ino +++ /dev/null @@ -1,40 +0,0 @@ -/* - Mega multple serial test - - Receives from the main serial port, sends to the others. - Receives from serial port 1, sends to the main serial (Serial 0). - - This example works only on the Arduino Mega - - The circuit: - * Any serial device attached to Serial port 1 - * Serial monitor open on Serial port 0: - - created 30 Dec. 2008 - modified 20 May 2012 - by Tom Igoe & Jed Roach - - This example code is in the public domain. - - */ - - -void setup() { - // initialize both serial ports: - Serial.begin(9600); - Serial1.begin(9600); -} - -void loop() { - // read from port 1, send to port 0: - if (Serial1.available()) { - int inByte = Serial1.read(); - Serial.write(inByte); - } - - // read from port 0, send to port 1: - if (Serial.available()) { - int inByte = Serial.read(); - Serial1.write(inByte); - } -} diff --git a/build/shared/examples/04.Communication/MultiSerialMega/MultiSerialMega.txt b/build/shared/examples/04.Communication/MultiSerialMega/MultiSerialMega.txt deleted file mode 100644 index 3383c902649..00000000000 --- a/build/shared/examples/04.Communication/MultiSerialMega/MultiSerialMega.txt +++ /dev/null @@ -1 +0,0 @@ -Use two of the serial ports available on the Arduino Mega. \ No newline at end of file