user48730: 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


user38721: The esp doesn't have an eeprom, but emulates it in its flash. Therefore 100.000 cylces will not apply, it's more like 10.000 cycles for flash.
The easiest way to prepare a datatype to be stored as bytes is to use union like follows:
union Converter{
  uint32_t ui32;
  byte eeprom_bytes[4];
}convert;

void convert_for_eeprom (uint32_t your_number) {
  convert.ui32=your_number;
  // convert.eeprom_bytes contains the 4-byte represenstation of your number, write those to eeprom
}

uint32_t convert_from_eeprom () {
  // read four bytes from eeprom and assign those to convert.eeprom_bytes
  return convert.ui32;
}

Note that this isn't a type conversion and the value of convert.eeprom_bytes are not meant to be processed, as they are simply interpreted as if they were a four-byte array, indeed those bytes contain "dumb" values. This way you can "convert" any datatype for byte-wise storage and read-back respectively.
Another option to convert a 32 bit integer to 4 bytes is by using bit-wise operations:
uint32_t your_number=100000;
byte b1=your_number;
byte b2=your_number>>8;
byte b3=your_number>>16;
byte b4=your_number>>24;

But this only makes sense for integers and I suggest taking a look at union.

user37622: to save any variable to EEPROM use EEPROM.put(), to read it use EEPROM.get(). example
EEPROM.put(EEPROM_COUNT_ADDR, count);
EEPROM.get(EEPROM_COUNT_ADDR, count);
On esp8266 EEPROM is emulated in flash and there the whole page wears out. The EEPROM library of esp8266 does what can be done to protect the flash pages used for EEPROM emulation.

48730: <p>I'm using Wemos mini in my project. I wish to store a Boolean value in cell #0, which changes every boot.</p>

<p>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.</p>

<p>Reading and writing using <code>#include &lt;EEPROM.h&gt;</code> is done as needed, but since each cell can store a byte, it can only reach 255.</p>

<p>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....).</p>

<p>Guy</p>

<p><strong>EDIT1</strong></p>

<p>Part or relevant code: </p>

<pre><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));
        }
}
</code></pre>

<p>and its output:</p>

<pre><code>Ȥl⸮⸮BGS[⸮&lt;b8ɗ⸮BEGIN:
22:40:58.732 -&gt; value in flash: 160
</code></pre>
 38721: <p>The esp doesn't have an eeprom, but emulates it in its flash. Therefore 100.000 cylces will not apply, it's more like 10.000 cycles for flash.</p>

<p>The easiest way to prepare a datatype to be stored as bytes is to use <a href="https://en.cppreference.com/w/cpp/language/union" rel="nofollow noreferrer">union</a> like follows:</p>

<pre><code>union Converter{
  uint32_t ui32;
  byte eeprom_bytes[4];
}convert;

void convert_for_eeprom (uint32_t your_number) {
  convert.ui32=your_number;
  // convert.eeprom_bytes contains the 4-byte represenstation of your number, write those to eeprom
}

uint32_t convert_from_eeprom () {
  // read four bytes from eeprom and assign those to convert.eeprom_bytes
  return convert.ui32;
}
</code></pre>

<p>Note that this isn't a type conversion and the value of convert.eeprom_bytes are not meant to be processed, as they are simply interpreted as if they were a four-byte array, indeed those bytes contain "dumb" values. This way you can "convert" <strong>any datatype</strong> for byte-wise storage and read-back respectively.</p>

<p>Another option to convert a 32 bit integer to 4 bytes is by using bit-wise operations:</p>

<pre><code>uint32_t your_number=100000;
byte b1=your_number;
byte b2=your_number&gt;&gt;8;
byte b3=your_number&gt;&gt;16;
byte b4=your_number&gt;&gt;24;
</code></pre>

<p>But this only makes sense for integers and I suggest taking a look at <code>union</code>.</p>
 37622: <p>to save any variable to EEPROM use <a href="https://www.arduino.cc/en/Reference/EEPROMPut" rel="nofollow noreferrer"><code>EEPROM.put()</code></a>, to read it use <code>EEPROM.get()</code>. example</p>

<p><code>EEPROM.put(EEPROM_COUNT_ADDR, count);</code></p>

<p><code>EEPROM.get(EEPROM_COUNT_ADDR, count);</code></p>

<p>On esp8266 EEPROM is emulated in flash and there <strong>the whole page wears out</strong>. <a href="https://arduino-esp8266.readthedocs.io/en/latest/libraries.html#eeprom" rel="nofollow noreferrer">The EEPROM library</a> of esp8266 does what can be done to protect the flash pages used for EEPROM emulation.</p>
