Go Down

Topic: EEPROM.put write change clarification (Read 368 times) previous topic - next topic

bionicbone

It says here:
https://www.arduino.cc/en/Tutorial/EEPROMPut

"EEPROM.update() that writes data only if it is different from the previous content of the locations to be written"

It maybe a dumb question, but if I have a custom structure with say one int and a float value, if I put this custom structure to the EEPROM and only the float has changed value does the int data also write?

i.e. the structure has changed so everything is written.

Or is it literally as written above if the address value is the same then nothing is written to that EEPROM address

Kev

pert

It does an EEPROM.update() on each cell of the EEPROM needed to store the structure. So it will only write when that byte of the structure is different from the value already in the EEPROM cell. So not only will the int data not be written, individual bytes of the float won't even be written if they are not different.

bionicbone

Thank you for responding.

it sounds perfect for what i want to do.

Kev

pert

You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per

Go Up