Need quick EEPROM troubleshooting help

I´m trying to write and read an array of floats to EEPROM, i know my code isn´t clean or best practice, but i just don´t get why it won´t work.

Thanks for any advice!!

#include <EEPROM.h>

int EPadress = 0;

float array1[6] = {1.1, 1.2, 1.3, 1.4, 1.5, 1.6}; //the array i want to save
float array2[6];
const int increment = 16; //save to this when reading
void save(float);

void setup(){
Serial.begin(9600);

save(array1);

look();
}

void save(float arr) // function to save Array
{
for (int i = 0; i < 6*increment; i += increment)
{

float val = arr[i / increment];
int adress = EPadress + i;
EEPROM.update(adress, val);
Serial.print(“Adress =” );
Serial.print(adress);
Serial.print(" Value = ");
Serial.println(val);
}
Serial.println();
Serial.println(“Array Saved!”);
}

void look() //read Array
{
for (int i = 0; i < 6*increment; i += increment)
{

int adress = EPadress + i;
EEPROM.get(adress, array2[i / increment]);

Serial.print(“Adress =” );
Serial.print(adress);
Serial.print(" Value = ");
Serial.println(array2[i / increment]);
}
Serial.println();
Serial.println(“Array read!”);
}

void loop()
{
}

What makes you say it doesn't work? (ie: You haven't posted the output, or said what kind of problem you're having. Is there a compile error? What is it? Does it upload and not do what you think? What's the output?)

You should get in the habit of including that kind of information when asking for help, it will save your time and ours.

Just realized my mistake it works when using EEPROM.put, EEPROM.update aparently only works for bytes.

@DrAzzy output was nan

{
 for (int i = 0; i < 6*increment; i += increment)

What’s that all about?
Any reason for not using put and get?

#include <EEPROM.h>

float array1[6] = { 1.1, 1.2, 1.3, 1.4, 1.5, 1.6 };  //the array i want to save
float array2[6];

int EPadress = 0;

void setup() {
  Serial.begin(250000);
  EEPROM.put(EPadress, array1);
  EEPROM.get(EPadress, array2);
  Serial.print(F("array2[6] = { "));
  for (byte i = 0; i < 6; i++)  {
    Serial.print(array2[i], 1);
    if (i != 5) {
      Serial.print(F(", "));
    }
  }
  Serial.println(F(" };"));
}
void loop() {}
array2[6] = { 1.1, 1.2, 1.3, 1.4, 1.5, 1.6 };

Ok thats the right way to do it, thanks alot!!!

no, there is no reason for not using put and get, the increment was just some weird way to space the adresses out because the floats take more than one byte.

EEPROM.put() does have the same behavior as EEPROM.update() in that it only writes if the value already in EEPROM is different from the value to be written.

blutorange:
Ok thats the right way to do it, thanks alot!!!

no, there is no reason for not using put and get, the increment was just some weird way to space the adresses out because the floats take more than one byte.

So instead of picking some random value that you hope is right, use the sizeof function and they'll be spaced out perfectly.

const int increment = sizeof(float);