Setting a condition with if that will stick...

I know the title sucks…

Basically I need a condition to stick if it met, and not change back.

So for instance

if (digitalRead(front) == HIGH) {
        alarmFunction(); //call alarm function
      }

as soon as the state chances back to LOW on the pin, is stops calling the function…

I’ve searched everywhere and I’m at a loos on this one…

thanks

Have a look at the state change example in the IDE

void loop() {
    static bool alarm = false;
    if (digitalRead(front) == HIGH)
        alarm = true;
    if (alarm)
        alarmFunction();
}

Pieter

Well that makes sense and was easy... thanks for the quick replies