Store two bytes in non-volatile memory

Using micropython how can I write two bytes of data to non-volatile memory, and then read them back after a power failure when power is restored to the Arduino ESP32 nano? The two bytes will change about once a month.

Hello @pindari, this might be helpful!

https://docs.micropython.org/en/latest/esp8266/tutorial/filesystem.html

(that is a tutorial page for the ESP8266, but it's applicable to the Nano ESP32 as well!)

1 Like

That is a common problem as the EEPROM is non existent but simulated in RAM and saved in flash. You need to commit the EEPROM to flash with this statement" EEPROM.commit();, for more information check ESP32 Flash Memory - Save Permanent Data | Random Nerd Tutorials

your link is not relevant, as the OP is looking for help on MicroPython, not C++.

@pindari , follow the link @lburelli posted.
You can write data to the file system and it's very efficient, I use it all the time :slight_smile:

1 Like