bool pressureIsStillIncreasing()
{
bool goingUp = true;
static int currPress;
static int prevPress = 0;
currPress = readCurrentPressure();
if(currPress <= prevPress)
goingUp = false;
prevPress = currPress;
return goingUp;
}
Write the readCurrentPressure() function to get the pressure from the sensor. Call this function once every second, half-second, week, whatever. If it returns true, leave the compressor running. Otherwise, turn it off, run in circles, scream and shout.