Initial Commit from upstream - v1.4
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
|
||||
#include <NewSoftSerial.h>
|
||||
|
||||
NewSoftSerial mySerial(2, 3);
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(57600);
|
||||
Serial.println("Goodnight moon!");
|
||||
|
||||
// set the data rate for the NewSoftSerial port
|
||||
mySerial.begin(4800);
|
||||
mySerial.println("Hello, world?");
|
||||
}
|
||||
|
||||
void loop() // run over and over again
|
||||
{
|
||||
|
||||
if (mySerial.available()) {
|
||||
Serial.print((char)mySerial.read());
|
||||
}
|
||||
if (Serial.available()) {
|
||||
mySerial.print((char)Serial.read());
|
||||
}
|
||||
}
|
||||
33
libraries/NewSoftSerial/Examples/TwoNSSTest/TwoNSSTest.pde
Normal file
33
libraries/NewSoftSerial/Examples/TwoNSSTest/TwoNSSTest.pde
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user