aboutsummaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@bug.st>2012-05-23 09:22:52 +0200
committerCristian Maglie <c.maglie@bug.st>2012-05-23 09:22:52 +0200
commita3dbb49c078176fca1610f4a61b0d1b23e3f37c9 (patch)
tree97c6f70b3f54da526db9acf93ed0b4ef24248b4e /libraries
parent3786e337e0211ca1ef94b37b03e891adfb3b5f9a (diff)
parent810803c6d3ab33a4496a89f41ef7e1dda15e8680 (diff)
Merge of arduino-1.0.1. Work in progress...
Diffstat (limited to 'libraries')
-rw-r--r--libraries/EEPROM/examples/eeprom_read/eeprom_read.ino4
-rw-r--r--libraries/Ethernet/examples/ChatServer/ChatServer.ino9
-rw-r--r--libraries/Ethernet/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino8
-rw-r--r--libraries/Ethernet/examples/DhcpChatServer/DhcpChatServer.ino9
-rw-r--r--libraries/Ethernet/examples/DnsWebClient/DnsWebClient.ino9
-rw-r--r--libraries/Ethernet/examples/PachubeClient/PachubeClient.ino9
-rw-r--r--libraries/Ethernet/examples/PachubeClientString/PachubeClientString.ino33
-rw-r--r--libraries/Ethernet/examples/TelnetClient/TelnetClient.ino8
-rw-r--r--libraries/Ethernet/examples/TwitterClient/TwitterClient.ino8
-rw-r--r--libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino7
-rw-r--r--libraries/Ethernet/examples/WebClient/WebClient.ino7
-rw-r--r--libraries/Ethernet/examples/WebServer/WebServer.ino8
-rwxr-xr-xlibraries/Ethernet/utility/w5100.h6
-rw-r--r--libraries/LiquidCrystal/examples/Autoscroll/Autoscroll.ino3
-rw-r--r--libraries/LiquidCrystal/examples/Blink/Blink.ino2
-rw-r--r--libraries/LiquidCrystal/examples/Cursor/Cursor.ino3
-rw-r--r--libraries/LiquidCrystal/examples/Display/Display.ino3
-rw-r--r--libraries/LiquidCrystal/examples/Scroll/Scroll.ino3
-rw-r--r--libraries/LiquidCrystal/examples/SerialDisplay/SerialDisplay.ino2
-rw-r--r--libraries/LiquidCrystal/examples/TextDirection/TextDirection.ino3
-rw-r--r--libraries/LiquidCrystal/examples/setCursor/setCursor.ino3
-rw-r--r--libraries/SD/examples/CardInfo/CardInfo.ino8
-rw-r--r--libraries/SD/examples/Datalogger/Datalogger.ino8
-rw-r--r--libraries/SD/examples/DumpFile/DumpFile.ino9
-rw-r--r--libraries/SD/examples/Files/Files.ino8
-rw-r--r--libraries/SD/examples/ReadWrite/ReadWrite.ino8
-rw-r--r--libraries/SD/examples/listfiles/listfiles.ino8
-rw-r--r--libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino7
-rw-r--r--libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino7
-rw-r--r--libraries/Stepper/examples/stepper_speedControl/stepper_speedControl.ino5
30 files changed, 170 insertions, 45 deletions
diff --git a/libraries/EEPROM/examples/eeprom_read/eeprom_read.ino b/libraries/EEPROM/examples/eeprom_read/eeprom_read.ino
index 88e3488..0709b2d 100644
--- a/libraries/EEPROM/examples/eeprom_read/eeprom_read.ino
+++ b/libraries/EEPROM/examples/eeprom_read/eeprom_read.ino
@@ -14,7 +14,11 @@ byte value;
void setup()
{
+ // initialize serial and wait for port to open:
Serial.begin(9600);
+ while (!Serial) {
+ ; // wait for serial port to connect. Needed for Leonardo only
+ }
}
void loop()
diff --git a/libraries/Ethernet/examples/ChatServer/ChatServer.ino b/libraries/Ethernet/examples/ChatServer/ChatServer.ino
index de75257..d50e5a6 100644
--- a/libraries/Ethernet/examples/ChatServer/ChatServer.ino
+++ b/libraries/Ethernet/examples/ChatServer/ChatServer.ino
@@ -12,7 +12,7 @@
created 18 Dec 2009
by David A. Mellis
- modified 12 March 2012
+ modified 9 Apr 2012
by Tom Igoe
*/
@@ -39,8 +39,13 @@ 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) {
+ ; // wait for serial port to connect. Needed for Leonardo only
+ }
+
+
Serial.print("Chat server address:");
Serial.println(Ethernet.localIP());
}
diff --git a/libraries/Ethernet/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino b/libraries/Ethernet/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino
index 630dd17..5eaaf24 100644
--- a/libraries/Ethernet/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino
+++ b/libraries/Ethernet/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino
@@ -9,6 +9,7 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 12 April 2011
+ modified 9 Apr 2012
by Tom Igoe
*/
@@ -27,8 +28,13 @@ byte mac[] = {
EthernetClient client;
void setup() {
- // start the serial library:
+ // Open serial communications and wait for port to open:
Serial.begin(9600);
+ // this check is only needed on the Leonardo:
+ while (!Serial) {
+ ; // wait for serial port to connect. Needed for Leonardo only
+ }
+
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
diff --git a/libraries/Ethernet/examples/DhcpChatServer/DhcpChatServer.ino b/libraries/Ethernet/examples/DhcpChatServer/DhcpChatServer.ino
index 5082054..09cbd43 100644
--- a/libraries/Ethernet/examples/DhcpChatServer/DhcpChatServer.ino
+++ b/libraries/Ethernet/examples/DhcpChatServer/DhcpChatServer.ino
@@ -12,6 +12,7 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 21 May 2011
+ modified 9 Apr 2012
by Tom Igoe
Based on ChatServer example by David A. Mellis
@@ -34,8 +35,14 @@ 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);
+ // this check is only needed on the Leonardo:
+ 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");
if (Ethernet.begin(mac) == 0) {
diff --git a/libraries/Ethernet/examples/DnsWebClient/DnsWebClient.ino b/libraries/Ethernet/examples/DnsWebClient/DnsWebClient.ino
index 5c7a53a..c14abf4 100644
--- a/libraries/Ethernet/examples/DnsWebClient/DnsWebClient.ino
+++ b/libraries/Ethernet/examples/DnsWebClient/DnsWebClient.ino
@@ -9,7 +9,7 @@
created 18 Dec 2009
by David A. Mellis
- modified 12 April 2011
+ modified 9 Apr 2012
by Tom Igoe, based on work by Adrian McEwen
*/
@@ -28,8 +28,13 @@ 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) {
+ ; // wait for serial port to connect. Needed for Leonardo only
+ }
+
+
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
diff --git a/libraries/Ethernet/examples/PachubeClient/PachubeClient.ino b/libraries/Ethernet/examples/PachubeClient/PachubeClient.ino
index 4d4290d..dfd2d40 100644
--- a/libraries/Ethernet/examples/PachubeClient/PachubeClient.ino
+++ b/libraries/Ethernet/examples/PachubeClient/PachubeClient.ino
@@ -16,7 +16,7 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 15 March 2010
- updated 16 Mar 2012
+ modified 9 Apr 2012
by Tom Igoe with input from Usman Haque and Joe Saavedra
http://arduino.cc/en/Tutorial/PachubeClient
@@ -53,8 +53,13 @@ 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) {
+ ; // wait for serial port to connect. Needed for Leonardo only
+ }
+
+
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
diff --git a/libraries/Ethernet/examples/PachubeClientString/PachubeClientString.ino b/libraries/Ethernet/examples/PachubeClientString/PachubeClientString.ino
index 3535287..2a96e9f 100644
--- a/libraries/Ethernet/examples/PachubeClientString/PachubeClientString.ino
+++ b/libraries/Ethernet/examples/PachubeClientString/PachubeClientString.ino
@@ -1,12 +1,12 @@
/*
- Pachube sensor client with Strings
+ Cosm sensor client with Strings
- This sketch connects an analog sensor to Pachube (http://www.pachube.com)
+ This sketch connects an analog sensor to Cosm (http://www.cosm.com)
using a Wiznet Ethernet shield. You can use the Arduino Ethernet shield, or
the Adafruit Ethernet shield, either one will work, as long as it's got
a Wiznet Ethernet module on board.
- This example has been updated to use version 2.0 of the Pachube.com API.
+ This example has been updated to use version 2.0 of the Cosm.com API.
To make it work, create a feed with two datastreams, and give them the IDs
sensor1 and sensor2. Or change the code below to match your feed.
@@ -18,10 +18,10 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 15 March 2010
- updated 16 Mar 2012
+ modified 9 Apr 2012
by Tom Igoe with input from Usman Haque and Joe Saavedra
- http://arduino.cc/en/Tutorial/PachubeClientString
+ http://arduino.cc/en/Tutorial/CosmClientString
This code is in the public domain.
*/
@@ -30,14 +30,16 @@
#include <Ethernet.h>
-#define APIKEY "YOUR API KEY GOES HERE" // replace your pachube api key here
+/#define APIKEY "YOUR API KEY GOES HERE" // replace your Cosm api key here
#define FEEDID 00000 // replace your feed ID
#define USERAGENT "My Project" // user agent is the project name
+
// assign a MAC address for the ethernet controller.
// fill in your address here:
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+
// fill in an available IP address on your network here,
// for manual configuration:
IPAddress ip(10,0,1,20);
@@ -47,16 +49,21 @@ EthernetClient client;
// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
-//IPAddress server(216,52,233,122); // numeric IP for api.pachube.com
-char server[] = "api.pachube.com"; // name address for pachube API
+IPAddress server(216,52,233,121); // numeric IP for api.cosm.com
+//char server[] = "api.cosm.com"; // name address for Cosm API
unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
boolean lastConnected = false; // state of the connection last time through the main loop
-const unsigned long postingInterval = 10*1000; //delay between updates to Pachube.com
+const unsigned long postingInterval = 10*1000; //delay between updates to Cosm.com
void setup() {
- // start serial port:
+ // Open serial communications and wait for port to open:
Serial.begin(9600);
+ while (!Serial) {
+ ; // wait for serial port to connect. Needed for Leonardo only
+ }
+
+
// give the ethernet module time to boot up:
delay(1000);
// start the Ethernet connection:
@@ -76,7 +83,7 @@ void loop() {
dataString += sensorReading;
// you can append multiple readings to this String if your
- // pachube feed is set up to handle multiple values:
+ // Cosm feed is set up to handle multiple values:
int otherSensorReading = analogRead(A1);
dataString += "\nsensor2,";
dataString += otherSensorReading;
@@ -116,8 +123,8 @@ void sendData(String thisData) {
client.print("PUT /v2/feeds/");
client.print(FEEDID);
client.println(".csv HTTP/1.1");
- client.println("Host: api.pachube.com");
- client.print("X-PachubeApiKey: ");
+ client.println("Host: api.cosm.com");
+ client.print("X-CosmApiKey: ");
client.println(APIKEY);
client.print("User-Agent: ");
client.println(USERAGENT);
diff --git a/libraries/Ethernet/examples/TelnetClient/TelnetClient.ino b/libraries/Ethernet/examples/TelnetClient/TelnetClient.ino
index 5cf1ad8..3457125 100644
--- a/libraries/Ethernet/examples/TelnetClient/TelnetClient.ino
+++ b/libraries/Ethernet/examples/TelnetClient/TelnetClient.ino
@@ -13,6 +13,7 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 14 Sep 2010
+ modified 9 Apr 2012
by Tom Igoe
*/
@@ -38,8 +39,13 @@ 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) {
+ ; // wait for serial port to connect. Needed for Leonardo only
+ }
+
+
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println("connecting...");
diff --git a/libraries/Ethernet/examples/TwitterClient/TwitterClient.ino b/libraries/Ethernet/examples/TwitterClient/TwitterClient.ino
index a3b397d..3587d72 100644
--- a/libraries/Ethernet/examples/TwitterClient/TwitterClient.ino
+++ b/libraries/Ethernet/examples/TwitterClient/TwitterClient.ino
@@ -17,6 +17,7 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 21 May 2011
+ modified 9 Apr 2012
by Tom Igoe
This code is in the public domain.
@@ -51,8 +52,13 @@ void setup() {
currentLine.reserve(256);
tweet.reserve(150);
- // initialize serial:
+ // Open serial communications and wait for port to open:
Serial.begin(9600);
+ 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:");
if (!Ethernet.begin(mac)) {
diff --git a/libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino b/libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino
index b4e24b8..93ffe39 100644
--- a/libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino
+++ b/libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino
@@ -9,7 +9,7 @@
created 4 Sep 2010
by Michael Margolis
- modified 17 Sep 2010
+ modified 9 Apr 2012
by Tom Igoe
This code is in the public domain.
@@ -38,7 +38,12 @@ EthernetUDP Udp;
void setup()
{
+ // Open serial communications and wait for port to open:
Serial.begin(9600);
+ while (!Serial) {
+ ; // wait for serial port to connect. Needed for Leonardo only
+ }
+
// start Ethernet and UDP
if (Ethernet.begin(mac) == 0) {
diff --git a/libraries/Ethernet/examples/WebClient/WebClient.ino b/libraries/Ethernet/examples/WebClient/WebClient.ino
index 1806854..5d5d7f2 100644
--- a/libraries/Ethernet/examples/WebClient/WebClient.ino
+++ b/libraries/Ethernet/examples/WebClient/WebClient.ino
@@ -8,6 +8,7 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 18 Dec 2009
+ modified 9 Apr 2012
by David A. Mellis
*/
@@ -26,8 +27,12 @@ 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) {
+ ; // wait for serial port to connect. Needed for Leonardo only
+ }
+
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
diff --git a/libraries/Ethernet/examples/WebServer/WebServer.ino b/libraries/Ethernet/examples/WebServer/WebServer.ino
index 7cf2c53..ce8dbb1 100644
--- a/libraries/Ethernet/examples/WebServer/WebServer.ino
+++ b/libraries/Ethernet/examples/WebServer/WebServer.ino
@@ -10,7 +10,7 @@
created 18 Dec 2009
by David A. Mellis
- modified 20 Mar 2012
+ modified 9 Apr 2012
by Tom Igoe
*/
@@ -30,7 +30,13 @@ 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) {
+ ; // wait for serial port to connect. Needed for Leonardo only
+ }
+
+
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
diff --git a/libraries/Ethernet/utility/w5100.h b/libraries/Ethernet/utility/w5100.h
index 153aedb..8dccd9f 100755
--- a/libraries/Ethernet/utility/w5100.h
+++ b/libraries/Ethernet/utility/w5100.h
@@ -327,7 +327,11 @@ private:
inline static void initSS() { DDRB |= _BV(4); };
inline static void setSS() { PORTB &= ~_BV(4); };
inline static void resetSS() { PORTB |= _BV(4); };
-#elif defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB162__)
+#elif defined(__AVR_ATmega32U4__)
+ inline static void initSS() { DDRB |= _BV(6); };
+ inline static void setSS() { PORTB &= ~_BV(6); };
+ inline static void resetSS() { PORTB |= _BV(6); };
+#elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB162__)
inline static void initSS() { DDRB |= _BV(0); };
inline static void setSS() { PORTB &= ~_BV(0); };
inline static void resetSS() { PORTB |= _BV(0); };
diff --git a/libraries/LiquidCrystal/examples/Autoscroll/Autoscroll.ino b/libraries/LiquidCrystal/examples/Autoscroll/Autoscroll.ino
index 27123ad..1127d8f 100644
--- a/libraries/LiquidCrystal/examples/Autoscroll/Autoscroll.ino
+++ b/libraries/LiquidCrystal/examples/Autoscroll/Autoscroll.ino
@@ -32,7 +32,8 @@
This example code is in the public domain.
- http://www.arduino.cc/en/Tutorial/LiquidCrystal
+ http://arduino.cc/en/Tutorial/LiquidCrystalAutoscroll
+
*/
// include the library code:
diff --git a/libraries/LiquidCrystal/examples/Blink/Blink.ino b/libraries/LiquidCrystal/examples/Blink/Blink.ino
index e410424..9667b5d 100644
--- a/libraries/LiquidCrystal/examples/Blink/Blink.ino
+++ b/libraries/LiquidCrystal/examples/Blink/Blink.ino
@@ -32,7 +32,7 @@
This example code is in the public domain.
- http://www.arduino.cc/en/Tutorial/LiquidCrystal
+ http://arduino.cc/en/Tutorial/LiquidCrystalBlink
*/
diff --git a/libraries/LiquidCrystal/examples/Cursor/Cursor.ino b/libraries/LiquidCrystal/examples/Cursor/Cursor.ino
index 28e2a6a..05862a4 100644
--- a/libraries/LiquidCrystal/examples/Cursor/Cursor.ino
+++ b/libraries/LiquidCrystal/examples/Cursor/Cursor.ino
@@ -33,7 +33,8 @@
This example code is in the public domain.
- http://www.arduino.cc/en/Tutorial/LiquidCrystal
+ http://arduino.cc/en/Tutorial/LiquidCrystalCursor
+
*/
// include the library code:
diff --git a/libraries/LiquidCrystal/examples/Display/Display.ino b/libraries/LiquidCrystal/examples/Display/Display.ino
index b000731..a85effb 100644
--- a/libraries/LiquidCrystal/examples/Display/Display.ino
+++ b/libraries/LiquidCrystal/examples/Display/Display.ino
@@ -33,7 +33,8 @@
This example code is in the public domain.
- http://www.arduino.cc/en/Tutorial/LiquidCrystal
+ http://arduino.cc/en/Tutorial/LiquidCrystalDisplay
+
*/
// include the library code:
diff --git a/libraries/LiquidCrystal/examples/Scroll/Scroll.ino b/libraries/LiquidCrystal/examples/Scroll/Scroll.ino
index 71e5e8c..0d6d8dc 100644
--- a/libraries/LiquidCrystal/examples/Scroll/Scroll.ino
+++ b/libraries/LiquidCrystal/examples/Scroll/Scroll.ino
@@ -33,7 +33,8 @@
This example code is in the public domain.
- http://www.arduino.cc/en/Tutorial/LiquidCrystal
+ http://arduino.cc/en/Tutorial/LiquidCrystalScroll
+
*/
// include the library code:
diff --git a/libraries/LiquidCrystal/examples/SerialDisplay/SerialDisplay.ino b/libraries/LiquidCrystal/examples/SerialDisplay/SerialDisplay.ino
index 9727cee..a6f8f40 100644
--- a/libraries/LiquidCrystal/examples/SerialDisplay/SerialDisplay.ino
+++ b/libraries/LiquidCrystal/examples/SerialDisplay/SerialDisplay.ino
@@ -32,7 +32,7 @@
This example code is in the public domain.
- http://www.arduino.cc/en/Tutorial/LiquidCrystal
+ http://arduino.cc/en/Tutorial/LiquidCrystalSerial
*/
// include the library code:
diff --git a/libraries/LiquidCrystal/examples/TextDirection/TextDirection.ino b/libraries/LiquidCrystal/examples/TextDirection/TextDirection.ino
index 51bab1f..cabd8ea 100644
--- a/libraries/LiquidCrystal/examples/TextDirection/TextDirection.ino
+++ b/libraries/LiquidCrystal/examples/TextDirection/TextDirection.ino
@@ -32,7 +32,7 @@
This example code is in the public domain.
- http://www.arduino.cc/en/Tutorial/LiquidCrystal
+ http://arduino.cc/en/Tutorial/LiquidCrystalTextDirection
*/
@@ -49,7 +49,6 @@ void setup() {
lcd.begin(16, 2);
// turn on the cursor:
lcd.cursor();
- Serial.begin(9600);
}
void loop() {
diff --git a/libraries/LiquidCrystal/examples/setCursor/setCursor.ino b/libraries/LiquidCrystal/examples/setCursor/setCursor.ino
index 3c4edf3..e45c491 100644
--- a/libraries/LiquidCrystal/examples/setCursor/setCursor.ino
+++ b/libraries/LiquidCrystal/examples/setCursor/setCursor.ino
@@ -32,7 +32,8 @@
This example code is in the public domain.
- http://www.arduino.cc/en/Tutorial/LiquidCrystal
+ http://arduino.cc/en/Tutorial/LiquidCrystalSetCursor
+
*/
// include the library code:
diff --git a/libraries/SD/examples/CardInfo/CardInfo.ino b/libraries/SD/examples/CardInfo/CardInfo.ino
index fb2f6c3..0c2dfc5 100644
--- a/libraries/SD/examples/CardInfo/CardInfo.ino
+++ b/libraries/SD/examples/CardInfo/CardInfo.ino
@@ -16,7 +16,7 @@
created 28 Mar 2011
by Limor Fried
- modified 16 Mar 2011
+ modified 9 Apr 2012
by Tom Igoe
*/
// include the SD library:
@@ -35,7 +35,13 @@ const int chipSelect = 4;
void setup()
{
+ // Open serial communications and wait for port to open:
Serial.begin(9600);
+ 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.
// Note that even if it's not used as the CS pin, the hardware SS pin
diff --git a/libraries/SD/examples/Datalogger/Datalogger.ino b/libraries/SD/examples/Datalogger/Datalogger.ino
index 73d81af..a7f85ee 100644
--- a/libraries/SD/examples/Datalogger/Datalogger.ino
+++ b/libraries/SD/examples/Datalogger/Datalogger.ino
@@ -13,7 +13,7 @@
** CS - pin 4
created 24 Nov 2010
- updated 2 Dec 2010
+ modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
@@ -30,7 +30,13 @@ const int chipSelect = 4;
void setup()
{
+ // Open serial communications and wait for port to open:
Serial.begin(9600);
+ 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
// output, even if you don't use it:
diff --git a/libraries/SD/examples/DumpFile/DumpFile.ino b/libraries/SD/examples/DumpFile/DumpFile.ino
index 961717f..d83089a 100644
--- a/libraries/SD/examples/DumpFile/DumpFile.ino
+++ b/libraries/SD/examples/DumpFile/DumpFile.ino
@@ -12,6 +12,9 @@
** CS - pin 4
created 22 December 2010
+ by Limor Fried
+ modified 9 Apr 2012
+ by Tom Igoe
This example code is in the public domain.
@@ -27,7 +30,13 @@ const int chipSelect = 4;
void setup()
{
+ // Open serial communications and wait for port to open:
Serial.begin(9600);
+ 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
// output, even if you don't use it:
diff --git a/libraries/SD/examples/Files/Files.ino b/libraries/SD/examples/Files/Files.ino
index 5ed9fea..a15b862 100644
--- a/libraries/SD/examples/Files/Files.ino
+++ b/libraries/SD/examples/Files/Files.ino
@@ -11,7 +11,7 @@
created Nov 2010
by David A. Mellis
- updated 2 Dec 2010
+ modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
@@ -23,7 +23,13 @@ File myFile;
void setup()
{
+ // Open serial communications and wait for port to open:
Serial.begin(9600);
+ 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.
// Note that even if it's not used as the CS pin, the hardware SS pin
diff --git a/libraries/SD/examples/ReadWrite/ReadWrite.ino b/libraries/SD/examples/ReadWrite/ReadWrite.ino
index 9957218..5805fc8 100644
--- a/libraries/SD/examples/ReadWrite/ReadWrite.ino
+++ b/libraries/SD/examples/ReadWrite/ReadWrite.ino
@@ -11,7 +11,7 @@
created Nov 2010
by David A. Mellis
- updated 2 Dec 2010
+ modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
@@ -24,7 +24,13 @@ File myFile;
void setup()
{
+ // Open serial communications and wait for port to open:
Serial.begin(9600);
+ 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.
// Note that even if it's not used as the CS pin, the hardware SS pin
diff --git a/libraries/SD/examples/listfiles/listfiles.ino b/libraries/SD/examples/listfiles/listfiles.ino
index b2435a2..876c3f8 100644
--- a/libraries/SD/examples/listfiles/listfiles.ino
+++ b/libraries/SD/examples/listfiles/listfiles.ino
@@ -11,7 +11,7 @@
created Nov 2010
by David A. Mellis
- updated 2 Dec 2010
+ modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
@@ -23,7 +23,13 @@ File root;
void setup()
{
+ // Open serial communications and wait for port to open:
Serial.begin(9600);
+ 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.
// Note that even if it's not used as the CS pin, the hardware SS pin
diff --git a/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino b/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino
index 615d2b3..69bcc01 100644
--- a/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino
+++ b/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino
@@ -9,6 +9,7 @@
* TX is digital pin 3 (connect to RX of other device)
created back in the mists of time
+ modified 9 Apr 2012
by Tom Igoe
based on Mikal Hart's example
@@ -21,7 +22,13 @@ SoftwareSerial mySerial(2, 3); // RX, TX
void setup()
{
+ // Open serial communications and wait for port to open:
Serial.begin(57600);
+ while (!Serial) {
+ ; // wait for serial port to connect. Needed for Leonardo only
+ }
+
+
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
diff --git a/libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino b/libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino
index e870c6f..d9f8f45 100644
--- a/libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino
+++ b/libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino
@@ -17,6 +17,7 @@
* Second serial device's TX attached to digital pin 4, RX to pin 5
created 18 Apr. 2011
+ modified 9 Apr 2012
by Tom Igoe
based on Mikal Hart's twoPortRXExample
@@ -33,8 +34,12 @@ SoftwareSerial portTwo(4, 5);
void setup()
{
- // Start the hardware serial port
+ // Open serial communications and wait for port to open:
Serial.begin(9600);
+ while (!Serial) {
+ ; // wait for serial port to connect. Needed for Leonardo only
+ }
+
// Start each software serial port
portOne.begin(9600);
diff --git a/libraries/Stepper/examples/stepper_speedControl/stepper_speedControl.ino b/libraries/Stepper/examples/stepper_speedControl/stepper_speedControl.ino
index dbd0f7f..1a67a55 100644
--- a/libraries/Stepper/examples/stepper_speedControl/stepper_speedControl.ino
+++ b/libraries/Stepper/examples/stepper_speedControl/stepper_speedControl.ino
@@ -26,11 +26,10 @@ const int stepsPerRevolution = 200; // change this to fit the number of steps p
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8,9,10,11);
-int stepCount = 0; // number of steps the motor has taken
+int stepCount = 0; // number of steps the motor has taken
void setup() {
- // initialize the serial port:
- Serial.begin(9600);
+ // nothing to do inside the setup
}
void loop() {