I made a little joystick input recorder that stores the joystick state (8 directions + fire) and the time (how long was a button or direction pressed).
Example data would be like this (i = input, t = time in milliseconds):
i: 0 | t: 2003
i: 2 | t: 128
i: 0 | t: 28
i: 10 | t: 27
i: 2 | t: 36
i: 18 | t: 39
My problem is that I run out of memory on an Arduino Uno very quickly. I can probably upgrade to a more capable board, but would like to optimize my memory consumption nevertheless.
const byte max_record = 200;
byte sequence[max_record];
int time[max_record];
So I have 2 arrays for the input sequence (values between 0 and 32) and time (currently milliseconds between 0 and 30.000 or even higher).
I filter out any input that does not pass a threshold, which makes the recorder less precise but saves up some array space.
Another approach could be to reduce precision by dividing the milliseconds by 10 or 100, storing them in the new smaller size and multiplying them again when using the data again.
Any other advice is greatly appreciated.