Arduino (Counter as a Dead man Switch)

Hi PaulS

Thanks for your answer,

Sorry for the delay but I was out on the road for a job so I didn't had the
chance to spent time in front of my computer.

I did some tests this morning and I'm not sure how to fully implement your suggestion.

I wante to show you what I did and please, try not to laugh to much because like I said, I'm a newbie.

This is at the beginning of my code for the initialization.

  bool goingUp = true;
  static int currPress;
  static int prevPress = 0;

This is the fonction section

bool pressureIncreasing()
  
   {
   currPress = PSI;
   if(currPress <= prevPress)
   goingUp = false;
   

   Serial.println (currPress); // I add the 3 next lines to see if the value were ok
   Serial.println("    ");
   Serial.println (prevPress);


   prevPress = currPress;  
   return goingUp;

   if (goingUp = false)
   {
   stateRELAY1 = LOW;
   }
}

And in my Loop at the end I added the section's name with all the other I have.

I try to put only the name of each fonction in the loop so I can take them out
for troubleshooting when I need.

void loop(){

pressureIncreasing();

}

For now it's not working, I can see the values in the Serial.print with the 3 lines I added
but that's it.

I have no error message so far but no results also :slight_smile:

What can you tell me from here ?

Thanks

My goal will be to tell the code:

If the Pressure (PSI) did not increase by 25PSI in the last 3 minutes, close the compressor (stateRELAY1).