Advertisement
pleasedontcode

ESP32 EEPROM example

Aug 30th, 2024
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Arduino 0.40 KB | Source Code | 0 0
  1. #include <Preferences.h>
  2.  
  3. Preferences preferences;
  4.  
  5. void setup() {
  6.     Serial.begin(115200);
  7.     preferences.begin("my-app", false);  // Initialize preferences storage
  8.  
  9.     // Store a value
  10.     preferences.putInt("key", 123);
  11.  
  12.     // Retrieve the value
  13.     int value = preferences.getInt("key", 0);
  14.     Serial.println(value);
  15.  
  16.     preferences.end();
  17. }
  18.  
  19. void loop() {
  20.     // Your loop code
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement