I'm using Wemos mini in my project. I wish to store a Boolean value in cell #0, which changes every boot.
Since writing to EEPROM is limited to roughly 100,000 cycles - I want to store in cell #1 the amount of writing cycles done so far, so when reaching 100,000 , value will be stored in cell#2 and writing cycles will be stored in cell#3 and so on.
Reading and writing using #include <EEPROM.h>
is done as needed, but since each cell can store a byte, it can only reach 255.
My question is how to store a value of 10^6 (except of convert it to a*2^0 + b*2^1 + c*2^2 + d*2^3....).
Guy
EDIT1
Part or relevant code:
void setup() {
Serial.begin(9600);
Serial.println("BEGIN:");
if (HARD_REBOOT) {
EEPROM.begin(1024);
}
if (HARD_REBOOT) {
EEPROM.write(0,100000);
EEPROM.commit();
delay(50);
Serial.print("value in flash: ");
Serial.println(EEPROM.read(0));
}
}
and its output:
Ȥl⸮⸮BGS[⸮<b8ɗ⸮BEGIN:
22:40:58.732 -> value in flash: 160