-
Notifications
You must be signed in to change notification settings - Fork 7.7k
How to Use NVS? #7442
-
Hi,
I'm trying to migrate away from using EEPROM to NVS and could use some help. Please consider this a newbie question, although I've been doing basic arduino for a a while.
I've found ArduinoNvs.h https://github.com/rpolitex/ArduinoNvs which does help.
The biggest challenge is finding code that shows how to save a 'double' datatype into NVS on an ESP32. I did see a recommendation to put datatypes like these inside a struct, which I've done. However, I can't decipher how to save a 'struct' in NVS.
Here's the struct I'd like to save in NVS
struct NTC_Coef { double Coef1; double Coef2; double Coef3; double Coef4; } NCT = { 0.0014619791146952, 0.0001.894175741, 0.0000000842224008, -0.000011716827022565 };
Thanks for the help!
Steve
Beta Was this translation helpful? Give feedback.
All reactions
Howdy. It's in the docs:
Preferences API
Preferences Tutorial
Replies: 4 comments 3 replies
-
Howdy. It's in the docs:
Preferences API
Preferences Tutorial
Beta Was this translation helpful? Give feedback.
All reactions
-
Thank you. Yes, I reviewed those docs and references, but were unable to translate that into Arduino code for use... that's why I highlighted this being a 'newbie' question. Would greatly appreciate if there was a very basic ARDUINO IDE example to reference. I just can't find any.
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions
-
Beta Was this translation helpful? Give feedback.
All reactions
-
Beta Was this translation helpful? Give feedback.
All reactions
-
Thank you! The built in preferences works great and that link provided great examples. Very much appreciated!
Beta Was this translation helpful? Give feedback.
All reactions
-
There’s also this: https://randomnerdtutorials.com/esp32-save-data-permanently-preferences/
Exactly what was needed to resolve my // TODO: refactor from EEPROM to Preferences
marker.
Beta Was this translation helpful? Give feedback.
All reactions
-
Beta Was this translation helpful? Give feedback.