added serial opening mod for Leonardo in examples

This commit is contained in:
Federico Vanzati 2012-06-06 17:31:14 +02:00
parent 9c63ffb8b7
commit 970dd043ce
11 changed files with 55 additions and 21 deletions

View File

@ -18,8 +18,11 @@ char ssid[] = "yourNetwork"; // the name of your network
int status = WL_IDLE_STATUS; // the Wifi radio's status
void setup() {
// initialize serial:
Serial.begin(9600);
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {

View File

@ -30,8 +30,11 @@ int keyIndex = 0; // your network key Index numbe
int status = WL_IDLE_STATUS; // the Wifi radio's status
void setup() {
// initialize serial:
Serial.begin(9600);
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {

View File

@ -19,8 +19,11 @@ char pass[] = "secretPassword"; // your network password
int status = WL_IDLE_STATUS; // the Wifi radio's status
void setup() {
// initialize serial:
Serial.begin(9600);
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {

View File

@ -19,8 +19,11 @@
#include <WiFi.h>
void setup() {
// initialize serial and wait for the port to open:
Serial.begin(9600);
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {

View File

@ -34,8 +34,11 @@ WiFiServer server(23);
boolean alreadyConnected = false; // whether or not the client was connected previously
void setup() {
// start serial port:
Serial.begin(9600);
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {

View File

@ -46,8 +46,11 @@ boolean lastConnected = false; // state of the connection last t
const unsigned long postingInterval = 10*1000; //delay between updates to Cosm.com
void setup() {
// start serial port:
Serial.begin(9600);
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {

View File

@ -51,8 +51,11 @@ boolean lastConnected = false; // state of the connection last t
const unsigned long postingInterval = 10*1000; //delay between updates to cosm.com
void setup() {
// start serial port:
Serial.begin(9600);
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {

View File

@ -50,8 +50,11 @@ void setup() {
// reserve space for the strings:
currentLine.reserve(256);
tweet.reserve(150);
// start serial port:
Serial.begin(9600);
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {

View File

@ -40,7 +40,11 @@ IPAddress server(173,194,73,105); // numeric IP for Google (no DNS)
WiFiClient client;
void setup() {
Serial.begin(9600);
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {

View File

@ -36,8 +36,11 @@ boolean lastConnected = false; // state of the connection last
const unsigned long postingInterval = 10*1000; // delay between updates, in milliseconds
void setup() {
// start serial port:
Serial.begin(9600);
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {

View File

@ -29,8 +29,11 @@ int status = WL_IDLE_STATUS;
WiFiServer server(80);
void setup() {
// start serial port:
Serial.begin(9600);
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {