asking on logging data

Hi friends.

I would like to know your recommendation/advice on logging data. Sorry for this simple question. Its like this. I'm currently doing a project where needs to log data for every 1 minute and sample it for every 1 sec. It means that all the 60 data need to be averaged and the average value will be logged into the SD card. Thus, every 1 minute, 1 average data will be stored into the SD card. As for now, I log data for every 1 sec. :fearful:

Any advice?

Thanks in advance~

Look at the blink without delay example sketch for a demonstration of the preferred technique to carry out actions on a timed basis. You timed actions would be: every second, take a reading and update the average. Every minute, write the current average to a file on the SD card and reset the running average.

Look at the examples for the SD card to see how to create and write to a file.

Do you need to know the real-world time when each sample was written? If so, you need to provide access to some time source.

You will also need to decide how to name your data files and what format to use when writing to them. CSV (Comma Separated Variable) is a simple and widely recognised format.

If you have any possibiity of leaving the Arduino connected to a PC then this opens up the possibility of logging and time-stamping the data on the PC, which would be simpler and more reliable.