aboutsummaryrefslogtreecommitdiff
path: root/libraries/EEPROM
diff options
context:
space:
mode:
authorMartino Facchin <m.facchin@arduino.cc>2015-03-24 10:20:00 +0100
committerMartino Facchin <m.facchin@arduino.cc>2015-03-24 10:20:00 +0100
commitd8656b8c5249c9d06cd8ed96b2061759ab69b5bf (patch)
tree9d909e3d2f7bace3a7caeb6ea67223878933cd35 /libraries/EEPROM
parent5da9792cd61b5ba9eed9fb80874edb52081d6232 (diff)
EEPROM: examples: fix Serial for board Leonardo
Diffstat (limited to 'libraries/EEPROM')
-rw-r--r--libraries/EEPROM/examples/eeprom_crc/eeprom_crc.ino5
-rw-r--r--libraries/EEPROM/examples/eeprom_get/eeprom_get.ino5
-rw-r--r--libraries/EEPROM/examples/eeprom_put/eeprom_put.ino5
3 files changed, 12 insertions, 3 deletions
diff --git a/libraries/EEPROM/examples/eeprom_crc/eeprom_crc.ino b/libraries/EEPROM/examples/eeprom_crc/eeprom_crc.ino
index a4baacc..8461d56 100644
--- a/libraries/EEPROM/examples/eeprom_crc/eeprom_crc.ino
+++ b/libraries/EEPROM/examples/eeprom_crc/eeprom_crc.ino
@@ -14,7 +14,10 @@ void setup(){
//Start serial
Serial.begin(9600);
-
+ while (!Serial) {
+ ; // wait for serial port to connect. Needed for Leonardo only
+ }
+
//Print length of data to run CRC on.
Serial.print( "EEPROM length: " );
Serial.println( EEPROM.length() );
diff --git a/libraries/EEPROM/examples/eeprom_get/eeprom_get.ino b/libraries/EEPROM/examples/eeprom_get/eeprom_get.ino
index dcd8678..6620999 100644
--- a/libraries/EEPROM/examples/eeprom_get/eeprom_get.ino
+++ b/libraries/EEPROM/examples/eeprom_get/eeprom_get.ino
@@ -23,8 +23,11 @@ void setup(){
int eeAddress = 0; //EEPROM address to start reading from
Serial.begin( 9600 );
+ while (!Serial) {
+ ; // wait for serial port to connect. Needed for Leonardo only
+ }
Serial.print( "Read float from EEPROM: " );
-
+
//Get the float data from the EEPROM at position 'eeAddress'
EEPROM.get( eeAddress, f );
Serial.println( f, 3 ); //This may print 'ovf, nan' if the data inside the EEPROM is not a valid float.
diff --git a/libraries/EEPROM/examples/eeprom_put/eeprom_put.ino b/libraries/EEPROM/examples/eeprom_put/eeprom_put.ino
index e99b4bd..186cf95 100644
--- a/libraries/EEPROM/examples/eeprom_put/eeprom_put.ino
+++ b/libraries/EEPROM/examples/eeprom_put/eeprom_put.ino
@@ -25,7 +25,10 @@ struct MyObject{
void setup(){
Serial.begin(9600);
-
+ while (!Serial) {
+ ; // wait for serial port to connect. Needed for Leonardo only
+ }
+
float f = 123.456f; //Variable to store in EEPROM.
int eeAddress = 0; //Location we want the data to be put.