MorganS:
Second, to get a long-term average of something like RPM, it's mathematically incorrect to average the RPM of each second. You're taking an average of averages. It's much better to count the pulses for the whole minute and then divide that number by 60 seconds.#define DATALOG_INTERVAL 60000 //milliseconds - the time between logging the data readings
With your perspective on this, the average will only update every minute. Every "averaging" algorithm I have come across in industry uses a "rolling average", which can update every second, for example.
To do this you need some sort of "shift register" or "rotating storage". You can save the current RPM each second, losing the value 60 seconds ago, and average the whole data file.
Logging every 60 seconds would not produce a good average if the process was stopped 2 seconds into a minute cycle, then re-started 2 seconds before that minute ended.
And it is not "mathematically incorrect" to average averages, most measurement techniques use that.