1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Updated all serial in setup examples with a note about the serial check

This commit is contained in:
Tom Igoe
2012-04-02 11:11:46 -04:00
parent a631e4f834
commit 202bb102a0
32 changed files with 91 additions and 28 deletions

View File

@ -22,6 +22,7 @@
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
// prints title with ending line break

View File

@ -37,7 +37,9 @@ 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) ;
;
pinMode(2, INPUT); // digital sensor is on digital pin 2
establishContact(); // send a byte to establish contact until receiver responds

View File

@ -14,7 +14,9 @@
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while(!Serial) ;
// this check is only needed on the Leonardo:
while (!Serial) ;
;
// send an intro:
Serial.println("send any byte and I'll tell you everything I can about it");

View File

@ -19,7 +19,9 @@ String stringOne, stringTwo, stringThree;
void setup() {
// initialize serial and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) ;
;
stringOne = String("stringThree = ");
stringTwo = String("this string");

View File

@ -16,7 +16,9 @@ String stringOne, stringTwo;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while(!Serial) ;
// this check is only needed on the Leonardo:
while (!Serial) ;
;
stringOne = String("Sensor ");
stringTwo = String("value");

View File

@ -15,7 +15,9 @@
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while(!Serial) ;
// this check is only needed on the Leonardo:
while (!Serial) ;
;
Serial.println("\n\nString case changes:");
}

View File

@ -15,7 +15,9 @@
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while(!Serial) ;
// this check is only needed on the Leonardo:
while (!Serial) ;
;
Serial.println("\n\nString charAt() and setCharAt():");
}

View File

@ -17,7 +17,9 @@ String stringOne, stringTwo;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while(!Serial) ;
// this check is only needed on the Leonardo:
while (!Serial) ;
;
stringOne = String("this");
stringTwo = String("that");

View File

@ -15,7 +15,9 @@
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while(!Serial) ;
// this check is only needed on the Leonardo:
while (!Serial) ;
;
Serial.println("\n\nString indexOf() and lastIndexOf() functions:");

View File

@ -15,7 +15,9 @@
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while(!Serial) ;
// this check is only needed on the Leonardo:
while (!Serial) ;
;
Serial.println("\n\nString length() and trim():");
}

View File

@ -15,7 +15,9 @@
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while(!Serial) ;
// this check is only needed on the Leonardo:
while (!Serial) ;
;
Serial.println("\n\nString replace:");
}

View File

@ -15,7 +15,9 @@
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while(!Serial) ;
// this check is only needed on the Leonardo:
while (!Serial) ;
;
Serial.println("\n\nString startsWith() and endsWith():");

View File

@ -15,7 +15,9 @@
void setup() {
Serial.begin(9600);
// Wait for port to be opened:
// this check is only needed on the Leonardo:
while (!Serial) ;
;
Serial.println("\n\nString substring():");
}