mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Added Serial port check to all examples using Serial statements in the setup
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
|
||||
created 18 Dec 2009
|
||||
by David A. Mellis
|
||||
modified 12 March 2012
|
||||
modified 2 Apr 2012
|
||||
by Tom Igoe
|
||||
|
||||
*/
|
||||
@ -39,8 +39,10 @@ void setup() {
|
||||
Ethernet.begin(mac, ip, gateway, subnet);
|
||||
// start listening for clients
|
||||
server.begin();
|
||||
// open the serial port
|
||||
// Open serial communications and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
while(!Serial) ;
|
||||
|
||||
Serial.print("Chat server address:");
|
||||
Serial.println(Ethernet.localIP());
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
* Ethernet shield attached to pins 10, 11, 12, 13
|
||||
|
||||
created 12 April 2011
|
||||
modified 2 Apr 2012
|
||||
by Tom Igoe
|
||||
|
||||
*/
|
||||
@ -27,8 +28,10 @@ byte mac[] = {
|
||||
EthernetClient client;
|
||||
|
||||
void setup() {
|
||||
// start the serial library:
|
||||
// Open serial communications and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
while(!Serial) ;
|
||||
|
||||
// start the Ethernet connection:
|
||||
if (Ethernet.begin(mac) == 0) {
|
||||
Serial.println("Failed to configure Ethernet using DHCP");
|
||||
|
@ -12,6 +12,7 @@
|
||||
* Ethernet shield attached to pins 10, 11, 12, 13
|
||||
|
||||
created 21 May 2011
|
||||
modified 2 Apr 2012
|
||||
by Tom Igoe
|
||||
Based on ChatServer example by David A. Mellis
|
||||
|
||||
@ -34,8 +35,10 @@ EthernetServer server(23);
|
||||
boolean gotAMessage = false; // whether or not you got a message from the client yet
|
||||
|
||||
void setup() {
|
||||
// open the serial port
|
||||
// Open serial communications and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
while(!Serial) ;
|
||||
|
||||
// start the Ethernet connection:
|
||||
Serial.println("Trying to get an IP address using DHCP");
|
||||
if (Ethernet.begin(mac) == 0) {
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
created 18 Dec 2009
|
||||
by David A. Mellis
|
||||
modified 12 April 2011
|
||||
modified 2 Apr 2012
|
||||
by Tom Igoe, based on work by Adrian McEwen
|
||||
|
||||
*/
|
||||
@ -28,8 +28,10 @@ char serverName[] = "www.google.com";
|
||||
EthernetClient client;
|
||||
|
||||
void setup() {
|
||||
// start the serial library:
|
||||
// Open serial communications and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
while(!Serial) ;
|
||||
|
||||
// start the Ethernet connection:
|
||||
if (Ethernet.begin(mac) == 0) {
|
||||
Serial.println("Failed to configure Ethernet using DHCP");
|
||||
|
@ -16,7 +16,7 @@
|
||||
* Ethernet shield attached to pins 10, 11, 12, 13
|
||||
|
||||
created 15 March 2010
|
||||
updated 16 Mar 2012
|
||||
modified 2 Apr 2012
|
||||
by Tom Igoe with input from Usman Haque and Joe Saavedra
|
||||
|
||||
http://arduino.cc/en/Tutorial/PachubeClient
|
||||
@ -53,8 +53,10 @@ boolean lastConnected = false; // state of the connection last t
|
||||
const unsigned long postingInterval = 10*1000; //delay between updates to Pachube.com
|
||||
|
||||
void setup() {
|
||||
// start serial port:
|
||||
// Open serial communications and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
while(!Serial) ;
|
||||
|
||||
// start the Ethernet connection:
|
||||
if (Ethernet.begin(mac) == 0) {
|
||||
Serial.println("Failed to configure Ethernet using DHCP");
|
||||
|
@ -18,7 +18,7 @@
|
||||
* Ethernet shield attached to pins 10, 11, 12, 13
|
||||
|
||||
created 15 March 2010
|
||||
updated 16 Mar 2012
|
||||
modified 2 Apr 2012
|
||||
by Tom Igoe with input from Usman Haque and Joe Saavedra
|
||||
|
||||
http://arduino.cc/en/Tutorial/PachubeClientString
|
||||
@ -55,8 +55,10 @@ boolean lastConnected = false; // state of the connection last t
|
||||
const unsigned long postingInterval = 10*1000; //delay between updates to Pachube.com
|
||||
|
||||
void setup() {
|
||||
// start serial port:
|
||||
// Open serial communications and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
while(!Serial) ;
|
||||
|
||||
// give the ethernet module time to boot up:
|
||||
delay(1000);
|
||||
// start the Ethernet connection:
|
||||
|
@ -13,6 +13,7 @@
|
||||
* Ethernet shield attached to pins 10, 11, 12, 13
|
||||
|
||||
created 14 Sep 2010
|
||||
modified 2 Apr 2012
|
||||
by Tom Igoe
|
||||
|
||||
*/
|
||||
@ -38,8 +39,10 @@ EthernetClient client;
|
||||
void setup() {
|
||||
// start the Ethernet connection:
|
||||
Ethernet.begin(mac, ip);
|
||||
// start the serial library:
|
||||
// Open serial communications and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
while(!Serial) ;
|
||||
|
||||
// give the Ethernet shield a second to initialize:
|
||||
delay(1000);
|
||||
Serial.println("connecting...");
|
||||
|
@ -17,6 +17,7 @@
|
||||
* Ethernet shield attached to pins 10, 11, 12, 13
|
||||
|
||||
created 21 May 2011
|
||||
modified 2 Apr 2012
|
||||
by Tom Igoe
|
||||
|
||||
This code is in the public domain.
|
||||
@ -51,8 +52,10 @@ void setup() {
|
||||
currentLine.reserve(256);
|
||||
tweet.reserve(150);
|
||||
|
||||
// initialize serial:
|
||||
// Open serial communications and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
while(!Serial) ;
|
||||
|
||||
// attempt a DHCP connection:
|
||||
Serial.println("Attempting to get an IP address using DHCP:");
|
||||
if (!Ethernet.begin(mac)) {
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
created 4 Sep 2010
|
||||
by Michael Margolis
|
||||
modified 17 Sep 2010
|
||||
modified 2 Apr 2012
|
||||
by Tom Igoe
|
||||
|
||||
This code is in the public domain.
|
||||
@ -38,7 +38,9 @@ EthernetUDP Udp;
|
||||
|
||||
void setup()
|
||||
{
|
||||
// Open serial communications and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
while(!Serial) ;
|
||||
|
||||
// start Ethernet and UDP
|
||||
if (Ethernet.begin(mac) == 0) {
|
||||
|
@ -8,6 +8,7 @@
|
||||
* Ethernet shield attached to pins 10, 11, 12, 13
|
||||
|
||||
created 18 Dec 2009
|
||||
modified 2 Apr 2012
|
||||
by David A. Mellis
|
||||
|
||||
*/
|
||||
@ -26,8 +27,10 @@ IPAddress server(173,194,33,104); // Google
|
||||
EthernetClient client;
|
||||
|
||||
void setup() {
|
||||
// start the serial library:
|
||||
// Open serial communications and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
while(!Serial) ;
|
||||
|
||||
// start the Ethernet connection:
|
||||
if (Ethernet.begin(mac) == 0) {
|
||||
Serial.println("Failed to configure Ethernet using DHCP");
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
created 18 Dec 2009
|
||||
by David A. Mellis
|
||||
modified 20 Mar 2012
|
||||
modified 2 Apr 2012
|
||||
by Tom Igoe
|
||||
|
||||
*/
|
||||
@ -30,7 +30,10 @@ IPAddress ip(192,168,1, 177);
|
||||
EthernetServer server(80);
|
||||
|
||||
void setup() {
|
||||
// Open serial communications and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
while(!Serial) ;
|
||||
|
||||
// start the Ethernet connection and the server:
|
||||
Ethernet.begin(mac, ip);
|
||||
server.begin();
|
||||
|
Reference in New Issue
Block a user