#include <Preferences.h>
Preferences myprefs;
unsigned short my_pan_id=0;
const unsigned short default_my_pan_id = 32;
void setup() {
Serial.begin(115200);
myprefs.begin("myprefs");
if (myprefs.isKey("me_pan_id")) {
my_pan_id = myprefs.getUShort("me_pan_id");
Serial.printf("my id: %d\n", my_pan_id);
} else {
my_pan_id = default_my_pan_id;
myprefs.putUShort("me_pan_id", my_pan_id);
Serial.printf("id set: %d\n", my_pan_id);
}
delay(2000);
ESP.restart();
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}