diff options
Diffstat (limited to 'libraries/SoftwareSerial/examples')
-rw-r--r-- | libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino | 12 | ||||
-rw-r--r-- | libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino | 6 |
2 files changed, 8 insertions, 10 deletions
diff --git a/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino b/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino index f659133..d35303d 100644 --- a/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino +++ b/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino @@ -29,8 +29,7 @@ SoftwareSerial mySerial(10, 11); // RX, TX -void setup() -{ +void setup() { // Open serial communications and wait for port to open: Serial.begin(57600); while (!Serial) { @@ -45,11 +44,12 @@ void setup() mySerial.println("Hello, world?"); } -void loop() // run over and over -{ - if (mySerial.available()) +void loop() { // run over and over + if (mySerial.available()) { Serial.write(mySerial.read()); - if (Serial.available()) + } + if (Serial.available()) { mySerial.write(Serial.read()); + } } diff --git a/libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino b/libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino index 95881a6..2c501e5 100644 --- a/libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino +++ b/libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino @@ -42,8 +42,7 @@ SoftwareSerial portOne(10, 11); // on the Mega, use other pins instead, since 8 and 9 don't work on the Mega SoftwareSerial portTwo(8, 9); -void setup() -{ +void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { @@ -56,8 +55,7 @@ void setup() portTwo.begin(9600); } -void loop() -{ +void loop() { // By default, the last intialized port is listening. // when you want to listen on a port, explicitly select it: portOne.listen(); |