Hi all, In my code i have setup an empty array called Val that is 72 bits long. I am then taking readings from a lidar distance sensor and using the for loop feeding this into each element of the array. once all the elements have been filled the process just starts again and the new lidar readings are fed into the array elements.
for(int j = 0; j <= 71; j++){
// Take one TF Mini distance measurement
uint16_t dist = tfmini.getDistance();
uint16_t strength = tfmini.getRecentSignalStrength();
// Display the measurement
Serial.print(dist);
Serial.print(" cm sigstr: ");
Serial.println(strength);
int val[72];
val[j] = dist;
Serial.print(j);
Serial.print(" num value: ");
Serial.println(val[j]);
I would like to compare the current element value to the new one and if there is a reduction do X but if theres an increase do Y.
Any suggestions?
Thanks