mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-29 18:52:13 +01:00
Updated all serial in setup examples with a note about the serial check
This commit is contained in:
parent
a631e4f834
commit
202bb102a0
@ -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
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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:");
|
||||
}
|
||||
|
@ -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():");
|
||||
}
|
||||
|
@ -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");
|
||||
|
@ -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:");
|
||||
|
||||
|
@ -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():");
|
||||
}
|
||||
|
@ -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:");
|
||||
}
|
||||
|
@ -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():");
|
||||
|
||||
|
@ -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():");
|
||||
}
|
||||
|
@ -41,7 +41,9 @@ void setup() {
|
||||
server.begin();
|
||||
// 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.print("Chat server address:");
|
||||
Serial.println(Ethernet.localIP());
|
||||
|
@ -30,7 +30,9 @@ EthernetClient client;
|
||||
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) ;
|
||||
;
|
||||
|
||||
// start the Ethernet connection:
|
||||
if (Ethernet.begin(mac) == 0) {
|
||||
|
@ -37,7 +37,9 @@ boolean gotAMessage = false; // whether or not you got a message from the client
|
||||
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) ;
|
||||
;
|
||||
|
||||
// start the Ethernet connection:
|
||||
Serial.println("Trying to get an IP address using DHCP");
|
||||
|
@ -30,7 +30,9 @@ EthernetClient client;
|
||||
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) ;
|
||||
;
|
||||
|
||||
// start the Ethernet connection:
|
||||
if (Ethernet.begin(mac) == 0) {
|
||||
|
@ -55,7 +55,9 @@ 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);
|
||||
while(!Serial) ;
|
||||
// this check is only needed on the Leonardo:
|
||||
while (!Serial) ;
|
||||
;
|
||||
|
||||
// start the Ethernet connection:
|
||||
if (Ethernet.begin(mac) == 0) {
|
||||
|
@ -57,7 +57,9 @@ 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);
|
||||
while(!Serial) ;
|
||||
// this check is only needed on the Leonardo:
|
||||
while (!Serial) ;
|
||||
;
|
||||
|
||||
// give the ethernet module time to boot up:
|
||||
delay(1000);
|
||||
|
@ -41,7 +41,9 @@ void setup() {
|
||||
Ethernet.begin(mac, ip);
|
||||
// Open serial communications and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
while(!Serial) ;
|
||||
// this check is only needed on the Leonardo:
|
||||
while (!Serial) ;
|
||||
;
|
||||
|
||||
// give the Ethernet shield a second to initialize:
|
||||
delay(1000);
|
||||
|
@ -54,7 +54,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) ;
|
||||
;
|
||||
|
||||
// attempt a DHCP connection:
|
||||
Serial.println("Attempting to get an IP address using DHCP:");
|
||||
|
@ -40,7 +40,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) ;
|
||||
;
|
||||
|
||||
// start Ethernet and UDP
|
||||
if (Ethernet.begin(mac) == 0) {
|
||||
|
@ -29,7 +29,9 @@ EthernetClient client;
|
||||
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) ;
|
||||
;
|
||||
|
||||
// start the Ethernet connection:
|
||||
if (Ethernet.begin(mac) == 0) {
|
||||
|
@ -32,7 +32,9 @@ EthernetServer server(80);
|
||||
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) ;
|
||||
;
|
||||
|
||||
// start the Ethernet connection and the server:
|
||||
Ethernet.begin(mac, ip);
|
||||
|
@ -37,7 +37,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.print("\nInitializing SD card...");
|
||||
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
|
||||
|
@ -32,7 +32,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.print("Initializing SD card...");
|
||||
// make sure that the default chip select pin is set to
|
||||
|
@ -32,7 +32,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.print("Initializing SD card...");
|
||||
// make sure that the default chip select pin is set to
|
||||
|
@ -25,7 +25,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.print("Initializing SD card...");
|
||||
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
|
||||
|
@ -26,7 +26,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.print("Initializing SD card...");
|
||||
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
|
||||
|
@ -25,7 +25,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.print("Initializing SD card...");
|
||||
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
|
||||
|
@ -24,7 +24,9 @@ void setup()
|
||||
{
|
||||
// Open serial communications and wait for port to open:
|
||||
Serial.begin57600;
|
||||
while(!Serial) ;
|
||||
// this check is only needed on the Leonardo:
|
||||
while (!Serial) ;
|
||||
;
|
||||
|
||||
Serial.println("Goodnight moon!");
|
||||
|
||||
|
@ -36,7 +36,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) ;
|
||||
;
|
||||
|
||||
// Start each software serial port
|
||||
portOne.begin(9600);
|
||||
|
Loading…
x
Reference in New Issue
Block a user