diff options
| author | Tim Redfern <tim@eclectronics.org> | 2012-01-18 18:02:10 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2012-01-18 18:02:10 +0000 |
| commit | 8c3efb592b16b672fc353368c04d88d3a32cf1a2 (patch) | |
| tree | 9cf4887292432c656651012c5370009b4a69cddf /arduino_libs_0022/NewSoftSerial/Examples/TwoNSSTest/TwoNSSTest.pde | |
| parent | fe92239d966f0219e8b7caf6335a776938b4e0e3 (diff) | |
Diffstat (limited to 'arduino_libs_0022/NewSoftSerial/Examples/TwoNSSTest/TwoNSSTest.pde')
| -rw-r--r-- | arduino_libs_0022/NewSoftSerial/Examples/TwoNSSTest/TwoNSSTest.pde | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/arduino_libs_0022/NewSoftSerial/Examples/TwoNSSTest/TwoNSSTest.pde b/arduino_libs_0022/NewSoftSerial/Examples/TwoNSSTest/TwoNSSTest.pde new file mode 100644 index 0000000..73aa991 --- /dev/null +++ b/arduino_libs_0022/NewSoftSerial/Examples/TwoNSSTest/TwoNSSTest.pde @@ -0,0 +1,33 @@ +#include <NewSoftSerial.h>
+
+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);
+ }
+ }
+}
+
|
