Skip to content

Commit d8656b8

Browse files
committed
EEPROM: examples: fix Serial for board Leonardo
1 parent 5da9792 commit d8656b8

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

libraries/EEPROM/examples/eeprom_crc/eeprom_crc.ino

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ void setup(){
1414

1515
//Start serial
1616
Serial.begin(9600);
17-
17+
while (!Serial) {
18+
; // wait for serial port to connect. Needed for Leonardo only
19+
}
20+
1821
//Print length of data to run CRC on.
1922
Serial.print( "EEPROM length: " );
2023
Serial.println( EEPROM.length() );

libraries/EEPROM/examples/eeprom_get/eeprom_get.ino

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ void setup(){
2323
int eeAddress = 0; //EEPROM address to start reading from
2424

2525
Serial.begin( 9600 );
26+
while (!Serial) {
27+
; // wait for serial port to connect. Needed for Leonardo only
28+
}
2629
Serial.print( "Read float from EEPROM: " );
27-
30+
2831
//Get the float data from the EEPROM at position 'eeAddress'
2932
EEPROM.get( eeAddress, f );
3033
Serial.println( f, 3 ); //This may print 'ovf, nan' if the data inside the EEPROM is not a valid float.

libraries/EEPROM/examples/eeprom_put/eeprom_put.ino

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ struct MyObject{
2525
void setup(){
2626

2727
Serial.begin(9600);
28-
28+
while (!Serial) {
29+
; // wait for serial port to connect. Needed for Leonardo only
30+
}
31+
2932
float f = 123.456f; //Variable to store in EEPROM.
3033
int eeAddress = 0; //Location we want the data to be put.
3134

0 commit comments

Comments
 (0)