Start:
Touch16 b.5, w0 'Calibrating touch switch
Touch16 b.4, w1 'Calibrating touch switch
Touch16 b.3, w2 'Calibrating touch switch
Touch16 b.2, w3 'Calibrating touch switch
Touch16 b.1, w4 'Calibrating touch switch
debug
start2:
high c.4 'activates green tri-colout led
if pinc.1 = 1 then alarm1 'If the microswitch is opened when opened, set off the initial alarm
goto start2 'If it is closed do not activate the alarm'
'Continuously loop around keeping the green led perminantly active
alarm1:
high c.5 'Red tri-colour led activates creating amber colour'
high c.0 'buzzer is activated to warn consumer, sound command
delay:
b14=0
delay2:
b14=b14+1
pause 25
if b14>25 then Alarm2
goto delay2
Alarm2:
low c.4 'amber led to then red
high b.0 'Siren activates'
high c.3 'both white leds activate'
w9=w4 'If switch one is pressed, begin resetting the alarm sytem sequence
touch16 b.1, w5
If w9>w5 then
w6=w9-w5
else
w6=w5-w9
endif
If w6>250 then secondreset 'checking reset'
goto Alarm2 'If switch one isn't pressed, alarm system 2 remains active
deactivate:
w9=w4
touch16 b.1, w5
gosub differentvalue2
wait 1
low b.0 'Siren deactivated
wait 3
high c.4 'Green tri-colour led activated
w9=w1
touch16 b.4, w5
gosub differentvalue2
pinc.1 = 0 'microswitch deactivated
goto start 'Return to beginning of process
checkloop:
w9=w0
touch16 b.5, w5 'tamper switch
gosub differentvalue
w9=w1
touch16 b.4, w5 'Activate and deactivate
gosub differentvalue2
w9=w2
touch16 b.3, w5 'tamper switch
gosub differentvalue
w9=w3
touch16 b.2, w5 'tamper switch
gosub differentvalue
w9=w4
touch16 b.1, w5 'Activate and deactivate'
gosub differentvalue2
differentvalue: 'New values for the calibration of each capacitive switch after they've been pressed'
If w9>w5 then
w6=w9-w5
else
w6=w5-w9
endif
If w6>250 then Alarm2 'If any of the switches, other than the activation and de-activation switches are pressed, alarm system will activate
return
differentvalue2:
If w9>w5 then
w6=w9-w5
else
w6=w5-w9
endif
If w6>250 then deactivate
return
secondreset:
b15=0
low b.0 'Siren deactivated
second2:
w9=w1
touch16 b.4, w5
If w9>w5 then
w6=w9-w5
else
w6=w5-w9
endif
If w6>250 then
goto start2 'Return to green tri-colour led being green, and monitoring the microswitch
else
b15=b15 +1
pause 25 'added counter as a timer'
endif
if b15>200 then Alarm2
goto second2 'check reset'