EEPROM: examples: fix Serial for board Leonardo
This commit is contained in:
parent
5da9792cd6
commit
d8656b8c52
|
@ -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() );
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue