#include <Preferences.h>
Preferences prefs;
unsigned long setPoints[100] = {12345, 45689, 78901};
unsigned long dataRetrieve1[100] = {0,0,0};
unsigned long duration[100] = {10, 20, 30};
unsigned long dataRetrieve2[100] = {0,0,0};
unsigned int entries = 3;
void setup() {
Serial.begin(115200);
prefs.begin("SetPoints"); //namespace
prefs.begin("Duration"); //namespace
prefs.begin("Enteries"); //namespace
//bytes can be put/get in namespace directly see prefs2struct example
//prefs.putBytes("IntegerArray", (byte*)(&dataStore), sizeof(dataStore));
//SavedIntegers is Key
prefs.putBytes("SetPoints", (byte*)(&setPoints), entries*4);
prefs.putBytes("Duration", (byte*)(&duration), entries*4);
prefs.putUInt("Entries", entries);
entries = prefs.getUInt("Entries", 0);
if(entries != 0){
prefs.getBytes("Duration", &dataRetrieve1, sizeof(dataRetrieve1));
prefs.getBytes("SetPoints", &dataRetrieve2, sizeof(dataRetrieve2));
int n = prefs.getBytesLength("SetPoints")/4;
Serial.println(n);
Serial.println(dataRetrieve1[0]);
Serial.println(dataRetrieve1[1]);
Serial.println(dataRetrieve1[2]);
Serial.println(dataRetrieve2[0]);
Serial.println(dataRetrieve2[1]);
Serial.println(dataRetrieve2[2]);
}
else{
Serial.println("no entries found");
}
}
void loop() {}