Storing Arrays in Arduino's EEPROM and Recalling Them

Hello!

I am working on a project where I am programming an LCD touchscreen that stores the data the user inputs into an array.

For example, each button they user presses has a value, and I have it coded where if that button is pressed, x value is stored in the y-position of the array.

I have coding for the LCD set up and working fine, and the data is storing the array as expected. This was the part where I was having trouble with:

Once the array data is “complete” - that is, all integer variables have been collected, I want to store this array that can be later recalled by the user at another time.

I’ve been looking around and there seems to be 2 ways: storing it into the Arduino memory of EEPROM or an SD card. I have looked at the SD card libraries and got really confused by them, so I’ve decided to go with the EEPROM route, as it won’t cycle the 100,000 times for my use. I think I’ve got it, but as I was thinking through the code, it looks like every time the array is saved, it would overwrite the previous one that is saved, as I am saying the “address” is 0. The issue I am facing is how to code it so that when a new array is created, my program will know to play that array in a new address in EEPROM?

I’ve included the EEPROM code bit, as my whole program’s really long with everything else that is going on.

#include <UTFT.h>
#include <UTouch.h>
#include <EEPROM.h>
#include "EEPROMAnything.h"

int Parameters[12];
int Wash[0];
int EEsize = 4096; //size in bytes of board's EEPROM

struct config_t
{
  int ParameterArray;
  int WashArray;
} configuration;

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

void loop()
{
                while (true) {
                  if (myTouch.dataAvailable()){
                     
                      getTouchCoordinates();
                          if ((y>=80) && (y<=130) && (x>=40) && (x<=270)){
                           configuration.WashParameterArray = WashParameter[12]; 
                           
                           EEPROM_writeAnything(0, configuration);
                           EEPROM_readAnything(0, configuration);
               
                           Serial.println(configuration.WashParameterArray);             
                          }
                          if ((y>=140) && (y<=190) && (x>=40) && (x<=270)){
                           homePage();
                          }
                          if ((y>=194) && (y<=232) && (x>=123) && (x<=203)){
                            homePage();
                          }      
                  }
                }
}

Add a single index that is stored into the eeprom and is incremented on the previous write by the size of the array.

So your first index is 0. Your write an array that is 64 bits long. Your increase the index by 64 and store into that index. Just make sure that index is big.