Closed rforro closed 3 years ago
However, the times must then also be in the ring buffer for each sensor, as different values are measured at different times. Of course the information requires additional memory. Why do you need the times? The return value of readData() contains the information if there are new values for a certain sensor. If you call the function regularly and evaluate the return value you should always have current data.
I've written this before I understood how the read function removes the read value. Now I don't think, that it's crucial to know the timestamp. Thanks anyway.
How about include function that delivers how old the data is aka how many seconds ago was the data received from sensor. It could be based on millis() and the actual value will be stored while pushing into ring-buffer. Than you can anytime calculate difference between stored and actual value in order to obtain their age.