#include <Preferences.h>

Preferences preferences;  // Create a Preferences object

int variable1;
String variable2;

void setup() {

  Serial.begin(9600);
  Serial.println("BEGIN");
  Serial.println();

}

void loop() {

  // Start preferences with the namespace "myApp" in read-write mode
  preferences.begin("myApp", false);

  variable1 = 45;
  // Store a signed integer
  //            my variable name, value to store
  preferences.putInt("variable1", variable1);
  Serial.print("Stored variable1: ");
  Serial.println(variable1);

  // Get the variable1 from the memory (with a default value 0 if not found in flesh)
  //                         my variable name, default value, if memory is empty
  variable1 = preferences.getInt("variable1", 0);
  Serial.print("Retrieved variable1: ");
  Serial.println(variable1);
  Serial.println();



  // Store a string
  variable2 = "Hello ESP32";
  preferences.putString("variable2", variable2);
  Serial.print("Stored variable2: ");
  Serial.println(variable2);

  //                      retrieve the string, with a default value (No data) if not found
  variable2 = preferences.getString("variable2", "No data");
  Serial.print("Retrieved variable2: ");
  Serial.println(variable2);

  // Calling preferences.clear(); removes all stored data under the current
  // namespace from the flash memory.
  preferences.clear();

  // End the preferences session
  preferences.end();

  delay(100000);
}
esp:0
esp:2
esp:4
esp:5
esp:12
esp:13
esp:14
esp:15
esp:16
esp:17
esp:18
esp:19
esp:21
esp:22
esp:23
esp:25
esp:26
esp:27
esp:32
esp:33
esp:34
esp:35
esp:3V3
esp:EN
esp:VP
esp:VN
esp:GND.1
esp:D2
esp:D3
esp:CMD
esp:5V
esp:GND.2
esp:TX
esp:RX
esp:GND.3
esp:D1
esp:D0
esp:CLK