Hi All,
This is what I have come up with as a first pass for the intruder alarm. I am sure there are plenty of ways to skin this cat, and I welcome alternative suggestions.
Regards
paulr
This is what I have come up with as a first pass for the intruder alarm. I am sure there are plenty of ways to skin this cat, and I welcome alternative suggestions.
Regards
paulr
Code:
'Burglar alarm v0.4
'Mooloolaba 2nd April '09
'Using Jaycar PIR/Microwave detector
'Sensor NC connection on pin4 (08M) or pin7 (20M) pulling input LOW.
'v0.3 added exit delay
'v0.4 took out 7seg display, added pins for siren and strobe outputs
'
symbol buzzer = 1 'pin1 leg6 for 08M, pin0 leg 18 for 20M
symbol strobe = 2 'pin2 leg5 for 08M, pin1 leg 17 for 20M
symbol loopcounter = b3
symbol sensorsw = pin4 'pin4 leg3 for 08M, pin7 leg 3 for 20M,
loopcounter = 36 'testing for continuous sensor detect in test2
start:
high 1 'chirp to alert that alarm is starting
pause 100
low 1
for b1 = 1 to 5
pause 60000 'exit time 5 minutes
next b1
test1:
low buzzer
low strobe
if sensorsw = 1 then
goto arming
endif
wait 2
goto test1
arming:
high buzzer 'chirp to alert that alarm is starting - time to switch off when returning
pause 100
low buzzer
pause 500
test2:
b2=0 'counter of sensor tests
for b1= 1 to loopcounter 'try x times in loopcounter, approx 10 sec
if sensorsw = 1 then 'to see if it is real
pause 200
inc b2
endif
next b1
alarm_on:
if b2=b3 then
high buzzer 'turn on pins for alarm
high strobe
wait 10
if sensorsw = 1 then 'if still on, keep alarm on
goto alarm_on
endif
endif
goto test1
end
Last edited: