Recording of sensor results but only retain the last 3 sets of data
It depends how big the data is... if one data set is 100 bytes, you can spend 300 bytes of internal SRAM memory.

What you also can do if the memory usage is too big, is to add external SRAM, like the 32K256 which has 32 kb (kilobyte) SRAM or the 23LC1024 which has 128 kb SRAM.

To loop through the data sets you can easily use a so called 'ring buffer'.

You allocate 3 sets of data (like 3 arrays of a byte array), and an index. the index you increase after every use like:

index = (index + 1) % 3 


External SRAM normally uses SPI to communicate with, and you can read/write it by a single byte, multiple bytes or page (typically 128 to 512 bytes). You cannot directly store variables in it, but you have to manually keep track where you store what ... for 3 data sets this will be relatively easy. You can even calculate (beforehand) the number of data sets that can be stored and cycle through them as needed.