1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-13 10:29:35 +01:00

Updated all comments for while (!Serial) additions to serial-based examples

This commit is contained in:
Tom Igoe 2012-04-09 09:51:35 -04:00
parent 1d0a5bfa50
commit 6f93d3fc17
21 changed files with 102 additions and 81 deletions

View File

@ -11,7 +11,7 @@
created 2006
by Nicholas Zambetti
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
@ -22,8 +22,9 @@
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// prints title with ending line break
Serial.println("ASCII Table ~ Character Map");

View File

@ -19,7 +19,7 @@
Created 26 Sept. 2005
by Tom Igoe
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe and Scott Fitzgerald
This example code is in the public domain.
@ -37,9 +37,10 @@ void setup()
{
// start serial port at 9600 bps and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
pinMode(2, INPUT); // digital sensor is on digital pin 2
establishContact(); // send a byte to establish contact until receiver responds

View File

@ -12,7 +12,7 @@
created 18 Dec 2009
by David A. Mellis
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
*/
@ -41,9 +41,10 @@ void setup() {
server.begin();
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.print("Chat server address:");
Serial.println(Ethernet.localIP());

View File

@ -9,7 +9,7 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 12 April 2011
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
*/
@ -31,8 +31,9 @@ void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {

View File

@ -12,7 +12,7 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 21 May 2011
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
Based on ChatServer example by David A. Mellis
@ -38,8 +38,10 @@ void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection:
Serial.println("Trying to get an IP address using DHCP");

View File

@ -9,7 +9,7 @@
created 18 Dec 2009
by David A. Mellis
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe, based on work by Adrian McEwen
*/
@ -30,9 +30,10 @@ EthernetClient client;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {

View File

@ -16,7 +16,7 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 15 March 2010
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe with input from Usman Haque and Joe Saavedra
http://arduino.cc/en/Tutorial/PachubeClient
@ -55,9 +55,10 @@ const unsigned long postingInterval = 10*1000; //delay between updates to Pachub
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {

View File

@ -18,7 +18,7 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 15 March 2010
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe with input from Usman Haque and Joe Saavedra
http://arduino.cc/en/Tutorial/PachubeClientString
@ -57,9 +57,10 @@ const unsigned long postingInterval = 10*1000; //delay between updates to Pachu
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// give the ethernet module time to boot up:
delay(1000);

View File

@ -13,7 +13,7 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 14 Sep 2010
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
*/
@ -41,9 +41,10 @@ void setup() {
Ethernet.begin(mac, ip);
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// give the Ethernet shield a second to initialize:
delay(1000);

View File

@ -17,7 +17,7 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 21 May 2011
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
This code is in the public domain.
@ -54,9 +54,10 @@ void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// attempt a DHCP connection:
Serial.println("Attempting to get an IP address using DHCP:");

View File

@ -9,7 +9,7 @@
created 4 Sep 2010
by Michael Margolis
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
This code is in the public domain.
@ -40,9 +40,10 @@ void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start Ethernet and UDP
if (Ethernet.begin(mac) == 0) {

View File

@ -8,7 +8,7 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 18 Dec 2009
modified 2 Apr 2012
modified 9 Apr 2012
by David A. Mellis
*/
@ -29,9 +29,9 @@ EthernetClient client;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {

View File

@ -10,7 +10,7 @@
created 18 Dec 2009
by David A. Mellis
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
*/
@ -32,9 +32,10 @@ EthernetServer server(80);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);

View File

@ -16,7 +16,7 @@
created 28 Mar 2011
by Limor Fried
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
*/
// include the SD library:
@ -37,9 +37,10 @@ void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.print("\nInitializing SD card...");
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.

View File

@ -13,7 +13,7 @@
** CS - pin 4
created 24 Nov 2010
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
@ -32,9 +32,10 @@ void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.print("Initializing SD card...");
// make sure that the default chip select pin is set to

View File

@ -13,7 +13,7 @@
created 22 December 2010
by Limor Fried
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
@ -32,9 +32,10 @@ void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.print("Initializing SD card...");
// make sure that the default chip select pin is set to

View File

@ -11,7 +11,7 @@
created Nov 2010
by David A. Mellis
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
@ -25,9 +25,10 @@ void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.print("Initializing SD card...");
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.

View File

@ -11,7 +11,7 @@
created Nov 2010
by David A. Mellis
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
@ -26,9 +26,10 @@ void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.print("Initializing SD card...");
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.

View File

@ -11,7 +11,7 @@
created Nov 2010
by David A. Mellis
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
@ -25,9 +25,10 @@ void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.print("Initializing SD card...");
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.

View File

@ -9,7 +9,7 @@
* TX is digital pin 3 (connect to RX of other device)
created back in the mists of time
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
based on Mikal Hart's example
@ -24,9 +24,10 @@ void setup()
{
// Open serial communications and wait for port to open:
Serial.begin57600;
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("Goodnight moon!");

View File

@ -17,7 +17,7 @@
* Second serial device's TX attached to digital pin 4, RX to pin 5
created 18 Apr. 2011
modified 2 Apr 2012
modified 9 Apr 2012
by Tom Igoe
based on Mikal Hart's twoPortRXExample
@ -36,9 +36,10 @@ void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// Start each software serial port
portOne.begin(9600);