I tried this code on my Arduino UNO board and it works fine, to store:
#include <EEPROM.h>
void setup() {
Serial.begin(9600);
int a=1111;
int eeAddress = 0;
EEPROM.put(eeAddress, a);
eeAddress += sizeof(int);
EEPROM.put(eeAddress, a);
Serial.print("Written");
}
void loop() {
/* Empty loop */
}
And this one to read the data when I unplug and plug the board again
#include <EEPROM.h>
void setup() {
int a;
int eeAddress = 0;
Serial.begin(9600);
while (!Serial) {
;
}
EEPROM.get(eeAddress, a);
Serial.println(a);
}
void loop() {
/* Empty loop */
}
This works fine on my Arduino Uno but when I try it on my NodeMcu v1.0 board, when I want to get the data I always get on serial monitor a strange number like "-17829890" whatever the number I store before