Source code : http://www.espitallier.fr/vrac/sketch_alz.ino
Schematics: in the image gallery.
*** How the project works: ***
It is simple. When the on/off switch is set, we wait for the door to be opened. We the door is opened, the reed relay acts as an "open circuit" and the arduino internal pull up resistor set the pin value to "1". So basically, what we need to wait is a rising edge on this signal.
Once the edge is detected we start the blinking of the led and the buzzer (with few seconds delay). The buzzer stop when we ask a reset (with the big red button) or after 30s. The blinking led only stop with the reset (red momentary button). This allow the user to know that an event has been triggered even if he didn't hear the buzzer.
*** Miscellaneous informations: ***
- I have used parts I already have, I the project was "urgent". So there is place for optimization (ON/OFF switch should cut the power, a capacitor in parallel of the relay could filter some noise,...)
- I try to do my best, but my english is not so good (You have probably already noticed that). Please forgive my mistakes !