36
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
36
Supported by:
S
ECTION
6 - P
ROGRAM
I
DEAS
.
Now that you have assembled and tested your alarm, it is time to develop your own
program. This program can make the alarm react in different ways to the digital and
analogue sensors.
Included on the next pages are two example programs. These are designed to give you a
starting point for your program. You may choose to modify them or to start a completely
new program if you prefer.
Program 1 Explanation
This general purpose program has a main loop which flashes the LED on and off, and
also checks the analogue sensor (fitted with a LDR) and digital input (fitted with a
switch). When the push switch is pressed an alarm is sounded for two seconds.
If the LDR light sensor is covered the piezo will make a awarning beep sound until the
light level rises again.
Program 2 Explanation
This program is designed as a fire alarm system, where the alarm is activated when
smoke is detected over the light sensor (ie the light sensor gives a lower value). Once
triggered the alarm is held on and cannot be switched off until power is removed from
the system.
The digital input is used as an ‘anti-tamper’ input. Whenever the case of the alarm is
closed, the switch will be held on - this is the normal condition. If the case is opened the
switch will open and so this triggers the piezo alarm until the case is closed again.