|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
' {$STAMP BS2}
|
|
|
|
|
' {$PBASIC 2.5}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PirMotion PIN 9
|
|
|
|
|
Spkr PIN 10
|
|
|
|
|
' DTMF output on pin 10
|
|
|
|
|
@ -64,22 +65,24 @@ Dial_Number:
|
|
|
|
|
FOR repeatA = 0 TO 5
|
|
|
|
|
|
|
|
|
|
ResetCount:
|
|
|
|
|
countDown = 20
|
|
|
|
|
countDown = 0
|
|
|
|
|
Hold:
|
|
|
|
|
'DEBUG "Wait motion stop"
|
|
|
|
|
IF IN9 = 1 THEN Hold ' Motion detected, wait until no motion
|
|
|
|
|
|
|
|
|
|
DO
|
|
|
|
|
DEBUG "*"
|
|
|
|
|
countDown = countDown - 1
|
|
|
|
|
countDown = countDown + 1
|
|
|
|
|
|
|
|
|
|
DEBUG "State of IN9: ", #IN9 ' PIR sensor input
|
|
|
|
|
'DEBUG "State of IN9: ", #IN9 ' PIR sensor input
|
|
|
|
|
IF IN9 = 1 THEN ResetCount ' Motion detected, restart countdown
|
|
|
|
|
|
|
|
|
|
PAUSE 1000
|
|
|
|
|
LOOP UNTIL (countDown < 0)
|
|
|
|
|
|
|
|
|
|
LOOP UNTIL (countDown > 20)
|
|
|
|
|
DEBUG "Timeout... Buzz..."
|
|
|
|
|
OUTPUT 10
|
|
|
|
|
FOR cntA = 0 TO 10
|
|
|
|
|
IF IN9 = 1 THEN ResetCount ' Motion detected, restart countdown
|
|
|
|
|
OUT10=1
|
|
|
|
|
PAUSE 300
|
|
|
|
|
OUT10=0
|
|
|
|
|
|