ESP32 - using EEPROM.write vs. using .put or .write (etc)
Posted: Wed Dec 02, 2020 10:38 pm
I'm working with an Adafruit Huzzah Feather ESP32:
I need to store some information between power cycles. Only about 32 bytes made up of integer variables.
Searches have led me to both EEPROM.write and to Preferences.putbytes (or .write). I believe that .write only works with individual bytes (0-255) of memory and I have to manage it, which is OK. I believe that .putbytes/.write works with a block of memory that I can map to a structure, which is also OK.
Seems like EEPROM is simpler since .putbytes/.write involved memory copies to/from a buffer.
Is there a reason to use one over the other?
Also, I've seen .putbytes in some examples, and .write in others - is there a difference.
And while I'm at it, I understand that re-writing variables to flash memory can be done a limited amount of times. But are we talking dozens, hundreds or thousands of times?
Thanks in advance for you help.
I need to store some information between power cycles. Only about 32 bytes made up of integer variables.
Searches have led me to both EEPROM.write and to Preferences.putbytes (or .write). I believe that .write only works with individual bytes (0-255) of memory and I have to manage it, which is OK. I believe that .putbytes/.write works with a block of memory that I can map to a structure, which is also OK.
Seems like EEPROM is simpler since .putbytes/.write involved memory copies to/from a buffer.
Is there a reason to use one over the other?
Also, I've seen .putbytes in some examples, and .write in others - is there a difference.
And while I'm at it, I understand that re-writing variables to flash memory can be done a limited amount of times. But are we talking dozens, hundreds or thousands of times?
Thanks in advance for you help.