Skip to content

Commit b04c58a

Browse files
tigoeTom Igoe
authored andcommitted
Updated all comments for while (!Serial) additions to serial-based examples
1 parent f362cf1 commit b04c58a

File tree

11 files changed

+53
-42
lines changed

11 files changed

+53
-42
lines changed

examples/ChatServer/ChatServer.ino

Lines changed: 5 additions & 4 deletions
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());

examples/DhcpAddressPrinter/DhcpAddressPrinter.ino

Lines changed: 4 additions & 3 deletions
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) {

examples/DhcpChatServer/DhcpChatServer.ino

Lines changed: 5 additions & 3 deletions
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");

examples/DnsWebClient/DnsWebClient.ino

Lines changed: 5 additions & 4 deletions
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) {

examples/PachubeClient/PachubeClient.ino

Lines changed: 5 additions & 4 deletions
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) {

examples/PachubeClientString/PachubeClientString.ino

Lines changed: 5 additions & 4 deletions
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);

examples/TelnetClient/TelnetClient.ino

Lines changed: 5 additions & 4 deletions
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);

examples/TwitterClient/TwitterClient.ino

Lines changed: 5 additions & 4 deletions
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:");

examples/UdpNtpClient/UdpNtpClient.ino

Lines changed: 5 additions & 4 deletions
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) {

examples/WebClient/WebClient.ino

Lines changed: 4 additions & 4 deletions
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) {

0 commit comments

Comments
 (0)