Saving array into EEPROM

I’m just trying to save array to EEPROM but i’m getting such a result

269422093
286265102
1118223
4368
17

#include <EEPROM.h>

int a = 12; //don't need
int b;
int Address = 0;

int maxHumVal = 60;
int minHumVal = 50;
float maxTempVal = 25;
float minTempVal = 24;
int maxAir = 1000;

int hourOn[5];
int minuteOn[5];
int hourOff[5];
int minuteOff[5];

void setup() {

  Serial.begin(115200);
  EEPROM.begin(512);
  Increase();
  delay(5000);
  saveToEEPROM();
  Address = 0;
  readFromEEPROM();

}
void saveToEEPROM() {

  for (int i = 0; i < 5; i++) {
    EEPROM.put(Address, hourOn[i]);
    Address += sizeof(int);
    EEPROM.put(Address, hourOn[i]);
    EEPROM.commit();
    Serial.println("Written");
    Serial.println(Address);
    Serial.println(hourOn[i]);
    Address++;
  }
}

void readFromEEPROM() {
  Serial.println("****************************************");
  EEPROM.get(Address, b);
  Serial.println(b);
  Address++;
  Serial.println(Address);
  EEPROM.get(Address, b);
  Serial.println(b);
  Address++;
  Serial.println(Address);
  EEPROM.get(Address, b);
  Serial.println(b);
  Address++;
  Serial.println(Address);
  EEPROM.get(Address, b);
  Serial.println(b);
  Address++;
  Serial.println(Address);
  EEPROM.get(Address, b);
  Serial.println(b);
  Address++;
  Serial.println(Address);
}

void Increase() {
  for (int i = 0; i < 5; i++) {
    a++;
    hourOn[i] = a;
    minuteOn[i] = a;
    hourOff[i] = a;
    minuteOff[i] = a;
  }
}

void loop() {

}

What am I doing wrong?

Not using the put and get methods?

Not being consistent with your increments?

Not zeroing Address?

TheMemberFormerlyKnownAsAWOL:
Not using the put and get methods?

Not being consistent with your increments?

Not zeroing Address?

I could not understand :confused:

Why do you save hourOn[i] twice?
Why do you increment Address by one instead of two at the end of the for-loop?

With EEPROM.put, you can save the full array in one go, no need to save each hourOn individually.

Lastly, you might benefit from reading up on struct to combine related information into one variable.

ramchoj:
I could not understand :confused:

You asked what you were doing wrong, so I gave you some suggestions.

int array1[] = {1,2,3,4,5};
int array2[] = {6,7,8,9,10};

int address = 0;

//Store
EEPROM.put(address, array1);
address += sizeof(array1);
EEPROM.put(address, array2);

//Load
address = 0;
EEPROM.get(address, array1);
address += sizeof(array1);
EEPROM.get(address, array2);