I am programming a bmp280 pressure sensor to deploy a parachute when the altitude starts to decrease on a water rocket but only when it starts to significantly decrease so it doesn’t deploy as soon as altitude decreases how would I detect the number going down but only when it decreases by a large amount?
I tried messing around with if statements to detect when it is decreasing but can not figure out how to only detect significant drops in the alltitude number.
You'll need to store the previous value of the sensor in a global (or static) variable and compare the current measurement with that, to check that the difference is greater than a predefined threshold.
Something like this: