Hey. I wanna measure the smallest value of a sensor kit's pressure sensor. I wrote the code to how to measure the values, but I need help, to how to measure the smallest value. I need it to a rocket parachute ignition. When the rocket is on apogee, there's the lowest pressure, and there I want to move a servo. So I don't know, how to measure the smallest value. Thanks!
Welcome to the forum
Start with the lowest recorded value variable set to an impossibly high value
Each time you measure the value, if it is less than the previously recorded lowest value then save the current value as the lowest value
int min_value = 10000; //larger than any expected value
// in loop:
...
value = read_pressure();
if (min_value > value) min_value = value; //update minimum value
...
There is a discrepancy between your topic title and what you have described
Highest or lowest ?
Oh, yeah sorry. I wanna measure the lowest.
Thank you so much. That helps a lot. Thanks!
Thank you!
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.