Skip to content

Commit 6f93d3f

Browse files
author
Tom Igoe
committed
Updated all comments for while (!Serial) additions to serial-based examples
1 parent 1d0a5bf commit 6f93d3f

File tree

21 files changed

+102
-81
lines changed

21 files changed

+102
-81
lines changed

Diff for: build/shared/examples/04.Communication/ASCIITable/ASCIITable.ino

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
1212
created 2006
1313
by Nicholas Zambetti
14-
modified 2 Apr 2012
14+
modified 9 Apr 2012
1515
by Tom Igoe
1616
1717
This example code is in the public domain.
@@ -22,8 +22,9 @@
2222
void setup() {
2323
//Initialize serial and wait for port to open:
2424
Serial.begin(9600);
25-
// this check is only needed on the Leonardo:
26-
while (!Serial) ;
25+
while (!Serial) {
26+
; // wait for serial port to connect. Needed for Leonardo only
27+
}
2728

2829
// prints title with ending line break
2930
Serial.println("ASCII Table ~ Character Map");

Diff for: build/shared/examples/04.Communication/SerialCallResponseASCII/SerialCallResponseASCII.ino

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
2020
Created 26 Sept. 2005
2121
by Tom Igoe
22-
modified 2 Apr 2012
22+
modified 9 Apr 2012
2323
by Tom Igoe and Scott Fitzgerald
2424
2525
This example code is in the public domain.
@@ -37,9 +37,10 @@ void setup()
3737
{
3838
// start serial port at 9600 bps and wait for port to open:
3939
Serial.begin(9600);
40-
// this check is only needed on the Leonardo:
41-
while (!Serial) ;
42-
;
40+
while (!Serial) {
41+
; // wait for serial port to connect. Needed for Leonardo only
42+
}
43+
4344

4445
pinMode(2, INPUT); // digital sensor is on digital pin 2
4546
establishContact(); // send a byte to establish contact until receiver responds

Diff for: libraries/Ethernet/examples/ChatServer/ChatServer.ino

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313
created 18 Dec 2009
1414
by David A. Mellis
15-
modified 2 Apr 2012
15+
modified 9 Apr 2012
1616
by Tom Igoe
1717
1818
*/
@@ -41,9 +41,10 @@ void setup() {
4141
server.begin();
4242
// Open serial communications and wait for port to open:
4343
Serial.begin(9600);
44-
// this check is only needed on the Leonardo:
45-
while (!Serial) ;
46-
;
44+
while (!Serial) {
45+
; // wait for serial port to connect. Needed for Leonardo only
46+
}
47+
4748

4849
Serial.print("Chat server address:");
4950
Serial.println(Ethernet.localIP());

Diff for: libraries/Ethernet/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Ethernet shield attached to pins 10, 11, 12, 13
1010
1111
created 12 April 2011
12-
modified 2 Apr 2012
12+
modified 9 Apr 2012
1313
by Tom Igoe
1414
1515
*/
@@ -31,8 +31,9 @@ void setup() {
3131
// Open serial communications and wait for port to open:
3232
Serial.begin(9600);
3333
// this check is only needed on the Leonardo:
34-
while (!Serial) ;
35-
;
34+
while (!Serial) {
35+
; // wait for serial port to connect. Needed for Leonardo only
36+
}
3637

3738
// start the Ethernet connection:
3839
if (Ethernet.begin(mac) == 0) {

Diff for: libraries/Ethernet/examples/DhcpChatServer/DhcpChatServer.ino

+5-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Ethernet shield attached to pins 10, 11, 12, 13
1313
1414
created 21 May 2011
15-
modified 2 Apr 2012
15+
modified 9 Apr 2012
1616
by Tom Igoe
1717
Based on ChatServer example by David A. Mellis
1818
@@ -38,8 +38,10 @@ void setup() {
3838
// Open serial communications and wait for port to open:
3939
Serial.begin(9600);
4040
// this check is only needed on the Leonardo:
41-
while (!Serial) ;
42-
;
41+
while (!Serial) {
42+
; // wait for serial port to connect. Needed for Leonardo only
43+
}
44+
4345

4446
// start the Ethernet connection:
4547
Serial.println("Trying to get an IP address using DHCP");

Diff for: libraries/Ethernet/examples/DnsWebClient/DnsWebClient.ino

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
created 18 Dec 2009
1111
by David A. Mellis
12-
modified 2 Apr 2012
12+
modified 9 Apr 2012
1313
by Tom Igoe, based on work by Adrian McEwen
1414
1515
*/
@@ -30,9 +30,10 @@ EthernetClient client;
3030
void setup() {
3131
// Open serial communications and wait for port to open:
3232
Serial.begin(9600);
33-
// this check is only needed on the Leonardo:
34-
while (!Serial) ;
35-
;
33+
while (!Serial) {
34+
; // wait for serial port to connect. Needed for Leonardo only
35+
}
36+
3637

3738
// start the Ethernet connection:
3839
if (Ethernet.begin(mac) == 0) {

Diff for: libraries/Ethernet/examples/PachubeClient/PachubeClient.ino

+5-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Ethernet shield attached to pins 10, 11, 12, 13
1717
1818
created 15 March 2010
19-
modified 2 Apr 2012
19+
modified 9 Apr 2012
2020
by Tom Igoe with input from Usman Haque and Joe Saavedra
2121
2222
http://arduino.cc/en/Tutorial/PachubeClient
@@ -55,9 +55,10 @@ const unsigned long postingInterval = 10*1000; //delay between updates to Pachub
5555
void setup() {
5656
// Open serial communications and wait for port to open:
5757
Serial.begin(9600);
58-
// this check is only needed on the Leonardo:
59-
while (!Serial) ;
60-
;
58+
while (!Serial) {
59+
; // wait for serial port to connect. Needed for Leonardo only
60+
}
61+
6162

6263
// start the Ethernet connection:
6364
if (Ethernet.begin(mac) == 0) {

Diff for: libraries/Ethernet/examples/PachubeClientString/PachubeClientString.ino

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Ethernet shield attached to pins 10, 11, 12, 13
1919
2020
created 15 March 2010
21-
modified 2 Apr 2012
21+
modified 9 Apr 2012
2222
by Tom Igoe with input from Usman Haque and Joe Saavedra
2323
2424
http://arduino.cc/en/Tutorial/PachubeClientString
@@ -57,9 +57,10 @@ const unsigned long postingInterval = 10*1000; //delay between updates to Pachu
5757
void setup() {
5858
// Open serial communications and wait for port to open:
5959
Serial.begin(9600);
60-
// this check is only needed on the Leonardo:
61-
while (!Serial) ;
62-
;
60+
while (!Serial) {
61+
; // wait for serial port to connect. Needed for Leonardo only
62+
}
63+
6364

6465
// give the ethernet module time to boot up:
6566
delay(1000);

Diff for: libraries/Ethernet/examples/TelnetClient/TelnetClient.ino

+5-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Ethernet shield attached to pins 10, 11, 12, 13
1414
1515
created 14 Sep 2010
16-
modified 2 Apr 2012
16+
modified 9 Apr 2012
1717
by Tom Igoe
1818
1919
*/
@@ -41,9 +41,10 @@ void setup() {
4141
Ethernet.begin(mac, ip);
4242
// Open serial communications and wait for port to open:
4343
Serial.begin(9600);
44-
// this check is only needed on the Leonardo:
45-
while (!Serial) ;
46-
;
44+
while (!Serial) {
45+
; // wait for serial port to connect. Needed for Leonardo only
46+
}
47+
4748

4849
// give the Ethernet shield a second to initialize:
4950
delay(1000);

Diff for: libraries/Ethernet/examples/TwitterClient/TwitterClient.ino

+5-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* Ethernet shield attached to pins 10, 11, 12, 13
1818
1919
created 21 May 2011
20-
modified 2 Apr 2012
20+
modified 9 Apr 2012
2121
by Tom Igoe
2222
2323
This code is in the public domain.
@@ -54,9 +54,10 @@ void setup() {
5454

5555
// Open serial communications and wait for port to open:
5656
Serial.begin(9600);
57-
// this check is only needed on the Leonardo:
58-
while (!Serial) ;
59-
;
57+
while (!Serial) {
58+
; // wait for serial port to connect. Needed for Leonardo only
59+
}
60+
6061

6162
// attempt a DHCP connection:
6263
Serial.println("Attempting to get an IP address using DHCP:");

Diff for: libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
created 4 Sep 2010
1111
by Michael Margolis
12-
modified 2 Apr 2012
12+
modified 9 Apr 2012
1313
by Tom Igoe
1414
1515
This code is in the public domain.
@@ -40,9 +40,10 @@ void setup()
4040
{
4141
// Open serial communications and wait for port to open:
4242
Serial.begin(9600);
43-
// this check is only needed on the Leonardo:
44-
while (!Serial) ;
45-
;
43+
while (!Serial) {
44+
; // wait for serial port to connect. Needed for Leonardo only
45+
}
46+
4647

4748
// start Ethernet and UDP
4849
if (Ethernet.begin(mac) == 0) {

Diff for: libraries/Ethernet/examples/WebClient/WebClient.ino

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Ethernet shield attached to pins 10, 11, 12, 13
99
1010
created 18 Dec 2009
11-
modified 2 Apr 2012
11+
modified 9 Apr 2012
1212
by David A. Mellis
1313
1414
*/
@@ -29,9 +29,9 @@ EthernetClient client;
2929
void setup() {
3030
// Open serial communications and wait for port to open:
3131
Serial.begin(9600);
32-
// this check is only needed on the Leonardo:
33-
while (!Serial) ;
34-
;
32+
while (!Serial) {
33+
; // wait for serial port to connect. Needed for Leonardo only
34+
}
3535

3636
// start the Ethernet connection:
3737
if (Ethernet.begin(mac) == 0) {

Diff for: libraries/Ethernet/examples/WebServer/WebServer.ino

+5-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
created 18 Dec 2009
1212
by David A. Mellis
13-
modified 2 Apr 2012
13+
modified 9 Apr 2012
1414
by Tom Igoe
1515
1616
*/
@@ -32,9 +32,10 @@ EthernetServer server(80);
3232
void setup() {
3333
// Open serial communications and wait for port to open:
3434
Serial.begin(9600);
35-
// this check is only needed on the Leonardo:
36-
while (!Serial) ;
37-
;
35+
while (!Serial) {
36+
; // wait for serial port to connect. Needed for Leonardo only
37+
}
38+
3839

3940
// start the Ethernet connection and the server:
4041
Ethernet.begin(mac, ip);

Diff for: libraries/SD/examples/CardInfo/CardInfo.ino

+5-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
1717
created 28 Mar 2011
1818
by Limor Fried
19-
modified 2 Apr 2012
19+
modified 9 Apr 2012
2020
by Tom Igoe
2121
*/
2222
// include the SD library:
@@ -37,9 +37,10 @@ void setup()
3737
{
3838
// Open serial communications and wait for port to open:
3939
Serial.begin(9600);
40-
// this check is only needed on the Leonardo:
41-
while (!Serial) ;
42-
;
40+
while (!Serial) {
41+
; // wait for serial port to connect. Needed for Leonardo only
42+
}
43+
4344

4445
Serial.print("\nInitializing SD card...");
4546
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.

Diff for: libraries/SD/examples/Datalogger/Datalogger.ino

+5-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
** CS - pin 4
1414
1515
created 24 Nov 2010
16-
modified 2 Apr 2012
16+
modified 9 Apr 2012
1717
by Tom Igoe
1818
1919
This example code is in the public domain.
@@ -32,9 +32,10 @@ void setup()
3232
{
3333
// Open serial communications and wait for port to open:
3434
Serial.begin(9600);
35-
// this check is only needed on the Leonardo:
36-
while (!Serial) ;
37-
;
35+
while (!Serial) {
36+
; // wait for serial port to connect. Needed for Leonardo only
37+
}
38+
3839

3940
Serial.print("Initializing SD card...");
4041
// make sure that the default chip select pin is set to

Diff for: libraries/SD/examples/DumpFile/DumpFile.ino

+5-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
created 22 December 2010
1515
by Limor Fried
16-
modified 2 Apr 2012
16+
modified 9 Apr 2012
1717
by Tom Igoe
1818
1919
This example code is in the public domain.
@@ -32,9 +32,10 @@ void setup()
3232
{
3333
// Open serial communications and wait for port to open:
3434
Serial.begin(9600);
35-
// this check is only needed on the Leonardo:
36-
while (!Serial) ;
37-
;
35+
while (!Serial) {
36+
; // wait for serial port to connect. Needed for Leonardo only
37+
}
38+
3839

3940
Serial.print("Initializing SD card...");
4041
// make sure that the default chip select pin is set to

Diff for: libraries/SD/examples/Files/Files.ino

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
1212
created Nov 2010
1313
by David A. Mellis
14-
modified 2 Apr 2012
14+
modified 9 Apr 2012
1515
by Tom Igoe
1616
1717
This example code is in the public domain.
@@ -25,9 +25,10 @@ void setup()
2525
{
2626
// Open serial communications and wait for port to open:
2727
Serial.begin(9600);
28-
// this check is only needed on the Leonardo:
29-
while (!Serial) ;
30-
;
28+
while (!Serial) {
29+
; // wait for serial port to connect. Needed for Leonardo only
30+
}
31+
3132

3233
Serial.print("Initializing SD card...");
3334
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.

0 commit comments

Comments
 (0)