Hi,
I finally found a way to do it
With help and reading. Thanks to this Forum.
void PsiWatchDog(){
if(prevPress == 0)
{
prevPress = PSI;
}
DateTime now = rtc.now();
OneSecond1 = now.second();
IntervalRTC1 = OneSecond1 - PreviousSec1;
if (IntervalRTC1 < 0){
IntervalRTC1 += 60;
}
if (IntervalRTC1 >180){ //Wait 3 minutes befoere check PSI increase
currPress = PSI;
if (currPress - prevPress > 30)
{
prevPress = 0;
lcd_2.setCursor (9,0);
lcd_2.print (" ");
}
else if (stateRELAY1 == HIGH)
{
stateRELAY1 = LOW;
stateRELAY2 = LOW;
stateRELAY3 = LOW;
lcd_2.setCursor (12,1);
lcd_2.print ("Leaks");
prevPress = PSI;
}
PreviousSec1 = OneSecond1;
}
}