From e9a73bbb3c14af340999f70146747787785f4fee Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Mon, 19 Dec 2011 18:20:33 +0000 Subject: initial commit --- .../Examples/TwoNSSTest/TwoNSSTest.pde | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 arduino_libs/NewSoftSerial/Examples/TwoNSSTest/TwoNSSTest.pde (limited to 'arduino_libs/NewSoftSerial/Examples/TwoNSSTest') diff --git a/arduino_libs/NewSoftSerial/Examples/TwoNSSTest/TwoNSSTest.pde b/arduino_libs/NewSoftSerial/Examples/TwoNSSTest/TwoNSSTest.pde new file mode 100644 index 0000000..73aa991 --- /dev/null +++ b/arduino_libs/NewSoftSerial/Examples/TwoNSSTest/TwoNSSTest.pde @@ -0,0 +1,33 @@ +#include + +NewSoftSerial nss(2, 3); +NewSoftSerial nss2(4, 5); + +void setup() +{ + nss2.begin(4800); + nss.begin(4800); + Serial.begin(115200); +} + +void loop() +{ + // Every 10 seconds switch from + // one serial GPS device to the other + if ((millis() / 10000) % 2 == 0) + { + if (nss.available()) + { + Serial.print(nss.read(), BYTE); + } + } + + else + { + if (nss2.available()) + { + Serial.print(nss2.read(), BYTE); + } + } +} + -- cgit v1.2.3