The idea is: If the door is closed, and the PIR sensor registers movement, the cat is alive. If the door stay closed, but the movement stops the cat is dead. Of course the cat can stay still, so we'll want to confirm, at least once.
Here is my approach:
while (door_state == closed) {
PIR.read;
if (PIR == true) {
activity = true;
}
if (activity == true && PIR == false) {
wait(10min.)
if (activity == true && PIR == false) {
alarm.activate
}
}
Trouble is, using the wait function hogs the processor. Would a more proper scheme, be to use a explicit timer or perhaps a threaded process. ?
I'm probably going to use either a beagleboard black or a raspberry pi.