 # saving unknown amount of sensor data

Good day folks,

so I am measuring two sensor signals, sensor A and sensor B. Both I want to save on an arduino. Afterwards I want to read from the saved data. Then I want keep reading sensor B and determine through the saved data, the value sensor A had. How do I implement this? I dont know exactly how many data points I am measuring. And how do I interpolate if in the second step between two B values if the saved B value is not exactly the measured B value?

thank you very much

Sounds like a good task for an SD-card :)

I dont know exactly how many data points I am measuring.

Do you know the maximum number of data points that will be measured ?

Hey,

yes I know the maximum number of points.

Then you need to size everything to that size and keep track with a variable of how many data points you actually take.

To map B to A you could: - Put all of the data in arrays, search for the closest recorded values of B below and above the new B and use linear interpolation. - Put all of the data in arrays and use MultiMap() to do the search and interpolation. https://playground.arduino.cc/Main/MultiMap - Put the data in a spreadsheet and use some form of regression to calculate the formula for A. Then build the formula into your sketch.

jacko91:
Hey,

yes I know the maximum number of points.

Can you give us a clue as to what the maximum will be as it could influence the advice given ?

Just use an SD card. If it is too small, buy a bigger one.

UKHeliBob: Can you give us a clue as to what the maximum will be as it could influence the advice given ?

And knowing the data types would also help. A "long int" takes up four types as much space as a "byte".