hi everyone im new to arduino and using sensors and such.
I know how to collect data from the accelerometer and get it to read off live data.
what am i am now trying to figure out is how to efficiently save data from 2 different time points and store them for use.
double avg_acceleration(Sample_obj & first_sample, Sample_obj & second_sample) {
double acceleration[3] = {-1, -1, -1};
acceleration[0] = second_sample.x - first_sample.x;
acceleration[1] = second_sample.y - first_sample.y;
acceleration[2] = second_sample.z - first_sample.z;}
i have created this so far but seem to be having a brain fart to how to insert use my accelerometer with it. i have labeled the time points first_sample and second_sample. ideally the time between first_sample and second_sample is 50 milliseconds. so i guess to restate my question, how do i read the sensors and insert accelerometer data from 2 time points into values in order to compare them.