From 46acf22fd48176ac253daa3f89269c2c65f60b30 Mon Sep 17 00:00:00 2001 From: Tom Igoe Date: Wed, 17 Jun 2009 21:37:30 +0000 Subject: [PATCH] --- .../MultiSerialMega/MultiSerialMega.pde | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 build/shared/dist/examples/Communication/MultiSerialMega/MultiSerialMega.pde diff --git a/build/shared/dist/examples/Communication/MultiSerialMega/MultiSerialMega.pde b/build/shared/dist/examples/Communication/MultiSerialMega/MultiSerialMega.pde new file mode 100644 index 000000000..f587c63d7 --- /dev/null +++ b/build/shared/dist/examples/Communication/MultiSerialMega/MultiSerialMega.pde @@ -0,0 +1,31 @@ +/* + 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 + by Tom Igoe + + */ + + +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.print(inByte, BYTE); + } +}