From b5a130afb51c971fd7ceca8834b6055f1eada253 Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Mon, 6 Jul 2015 15:18:33 +0200 Subject: Examples: mass code format. See example_formatter.conf --- .../EEPROM/examples/eeprom_put/eeprom_put.ino | 34 ++++++++++++---------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'libraries/EEPROM/examples/eeprom_put/eeprom_put.ino') diff --git a/libraries/EEPROM/examples/eeprom_put/eeprom_put.ino b/libraries/EEPROM/examples/eeprom_put/eeprom_put.ino index 186cf95..fe8a9fb 100644 --- a/libraries/EEPROM/examples/eeprom_put/eeprom_put.ino +++ b/libraries/EEPROM/examples/eeprom_put/eeprom_put.ino @@ -1,28 +1,28 @@ /*** eeprom_put example. - + This shows how to use the EEPROM.put() method. - Also, this sketch will pre-set the EEPROM data for the + Also, this sketch will pre-set the EEPROM data for the example sketch eeprom_get. - + Note, unlike the single byte version EEPROM.write(), the put method will use update semantics. As in a byte will only be written to the EEPROM if the data is actually different. Written by Christopher Andrews 2015 - Released under MIT licence. + Released under MIT licence. ***/ #include -struct MyObject{ +struct MyObject { float field1; byte field2; char name[10]; }; -void setup(){ +void setup() { Serial.begin(9600); while (!Serial) { @@ -31,15 +31,15 @@ void setup(){ float f = 123.456f; //Variable to store in EEPROM. int eeAddress = 0; //Location we want the data to be put. - - + + //One simple call, with the address first and the object second. - EEPROM.put( eeAddress, f ); - + EEPROM.put(eeAddress, f); + Serial.println("Written float data type!"); - + /** Put is designed for use with custom structures also. **/ - + //Data to store. MyObject customVar = { 3.14f, @@ -48,9 +48,11 @@ void setup(){ }; eeAddress += sizeof(float); //Move address to the next byte after float 'f'. - - EEPROM.put( eeAddress, customVar ); - Serial.print( "Written custom data type! \n\nView the example sketch eeprom_get to see how you can retrieve the values!" ); + + EEPROM.put(eeAddress, customVar); + Serial.print("Written custom data type! \n\nView the example sketch eeprom_get to see how you can retrieve the values!"); } -void loop(){ /* Empty loop */ } \ No newline at end of file +void loop() { + /* Empty loop */ +} \ No newline at end of file -- cgit v1.2.3-18-g5258