37
PICAXE-08 ALARM PROJECT
revolution
© copyright 2002 - AXE102 Alarm Student Project Notes Version 1.1
Revolution Education Ltd. Email: [email protected] Web: www.rev-ed.co.uk
37
Supported by:
Program 1
' ***** main loop *****
' loop here flashing lights
' and checking sensors
main:
' LED full on and read light value
high 0
readadc 1,b1
' if analogue value low then make sound
if b1 < 40 then beep
' if switch pushed do alarm
if pin3 = 1 then alarm
' do a delay
pause 500
' LED full off and check sensor again
low 0
readadc 1,b1
' if analogue value low then make sound
if b1 < 40 then beep
' if switch pushed do alarm
if pin3 = 1 then alarm
' do a delay
pause 500
goto main
' ***** make sound *****
beep:
sound 2,(120,50,80,50,120,50)
pause 200
goto main
' ***** alarm output on ****
alarm:
high 4
pause 2000
low 4
goto main