Alarm system

You need a coded latch.

byte latch = 0;

if(digitalRead(sensorPin) == HIGH) {

~latch; // latch = !latch; //Alternative

latch ? (/* IF stuff here /) : (/ ELSE here */);

}