Developing A-Level Project: Memory

I am developing the program for my Joystick project further. The Idea is that it times how long the user takes to press a certain button. And I would like to store these values.

Is the internal EEPROM the best place to store these?

Ben

Use the EEPROM to store values that must be preserved when the Arduino is powered off. Use RAM for all the usual run-time variables and state.

Do you need to store the button timings when the Arduino is "off"?

Yes I do.

I've written a function that runs after each button press:

void writeTime(){
  EEPROM.write(memoryAddress, byte(timeSec));  // Save time in S
  memoryAddress++;  // Select next memory space (address)
}

memoryAddress is a variable starting at 0

Is this correct?

Also, is there an easy way to find the average of all the values?

Looks OK to me. To compute the average, you'll need to know how many samples you have got. So, you'll need a way to start counting samples, and a way to stop counting and then do the calculation for the average.