#include // See https://docs.espressif.com/projects/arduino-esp32/en/latest/tutorials/preferences.html Preferences preferences; String S1 = "String numéro 1"; String S2 = "String numéro 2"; String S3 = "String numéro 3"; String S4 = "String numéro 4"; const byte tailleMax = 30; char cs1[tailleMax + 1] = "c-string numéro 1"; char cs2[tailleMax + 1] = "c-string numéro 2"; char cs3[tailleMax + 1] = "c-string numéro 3"; char cs4[tailleMax + 1] = "c-string numéro 4"; void setup() { Serial.begin(115200); preferences.begin("my-app", false); // on sauve tout preferences.putString("S1", S1); preferences.putString("S2", S2); preferences.putString("S3", S3); preferences.putString("S4", S4); preferences.putBytes("cs1", cs1, tailleMax + 1); preferences.putBytes("cs2", cs2, tailleMax + 1); preferences.putBytes("cs3", cs3, tailleMax + 1); preferences.putBytes("cs4", cs4, tailleMax + 1); String lectureS1 = ""; String lectureS2 = ""; String lectureS3 = "";; String lectureS4 = ""; char lectureCs1[tailleMax + 1] = {}; char lectureCs2[tailleMax + 1] = {}; char lectureCs3[tailleMax + 1] = {}; char lectureCs4[tailleMax + 1] = {}; Serial.println("AVANT LECTURE"); Serial.print("lectureS1 = "); Serial.println(lectureS1); Serial.print("lectureS2 = "); Serial.println(lectureS2); Serial.print("lectureS3 = "); Serial.println(lectureS3); Serial.print("lectureS4 = "); Serial.println(lectureS4); Serial.print("lectureCs1 = "); Serial.println(lectureCs1); Serial.print("lectureCs2 = "); Serial.println(lectureCs2); Serial.print("lectureCs3 = "); Serial.println(lectureCs3); Serial.print("lectureCs4 = "); Serial.println(lectureCs4); // on relit tout lectureS1 = preferences.getString("S1", ""); lectureS2 = preferences.getString("S2", ""); lectureS3 = preferences.getString("S3", ""); lectureS4 = preferences.getString("S4", ""); preferences.getBytes("cs1", lectureCs1, tailleMax + 1); preferences.getBytes("cs2", lectureCs2, tailleMax + 1); preferences.getBytes("cs3", lectureCs3, tailleMax + 1); preferences.getBytes("cs4", lectureCs4, tailleMax + 1); Serial.println("\n\nAPRES LECTURE"); Serial.print("lectureS1 = "); Serial.println(lectureS1); Serial.print("lectureS2 = "); Serial.println(lectureS2); Serial.print("lectureS3 = "); Serial.println(lectureS3); Serial.print("lectureS4 = "); Serial.println(lectureS4); Serial.print("lectureCs1 = "); Serial.println(lectureCs1); Serial.print("lectureCs2 = "); Serial.println(lectureCs2); Serial.print("lectureCs3 = "); Serial.println(lectureCs3); Serial.print("lectureCs4 = "); Serial.println(lectureCs4); preferences.end(); } void loop() {}