user65410: I have 7 float variables.
float temperature, differential, calibration,hta,lta,hha,lha; 
I want to store them all on the EEPROM memory, how do I calculate the addresses given that there type is float.
Thanks!

user31105: With the sizeof function:
int nrOfBytesOfTemperature = sizeof(temperature);

You can also use directly a type:
int nrOfBytesOfFloat = sizeof(float);


user37622: create a struct and store the struct
#include <EEPROM.h>

const int DATA_ADDR = 0;

struct MyData {
  float temperature, differential, calibration,hta,lta,hha,lha;
};

MyData data;

void setup() {
  data.temperature = 1.2;

  EEPROM.put(DATA_ADDR, data);

  EEPROM.get(DATA_ADDR, data);
}

void loop() {

}


65410: <p>I have 7 float variables.</p>

<p><code>float temperature, differential, calibration,hta,lta,hha,lha;</code> </p>

<p>I want to store them all on the EEPROM memory, how do I calculate the addresses given that there type is float.</p>

<p>Thanks!</p>
 31105: <p>With the <code>sizeof</code> function:</p>

<pre><code>int nrOfBytesOfTemperature = sizeof(temperature);
</code></pre>

<p>You can also use directly a type:</p>

<pre><code>int nrOfBytesOfFloat = sizeof(float);
</code></pre>
 37622: <p>create a struct and store the struct</p>

<pre><code>#include &lt;EEPROM.h&gt;

const int DATA_ADDR = 0;

struct MyData {
  float temperature, differential, calibration,hta,lta,hha,lha;
};

MyData data;

void setup() {
  data.temperature = 1.2;

  EEPROM.put(DATA_ADDR, data);

  EEPROM.get(DATA_ADDR, data);
}

void loop() {

}
</code></pre>
