Next: , Up: The Alarm System   [Contents]


2.6.1 Requirements

Our next alarm system has a pincode keypad, a multi-color LED, a siren, and sensors. The keypad silently discards invalid pincodes. The system has two basic sequences of events:

On power up the system is unarmed, the LED is green, and sensors are disabled.

  1. Green: unarmed.
  2. Yellow: Valid pincode entry arms the system, turns the LED yellow and enables sensors.
  3. Red: A sensor trigger disables the sensors and turns the LED red.
  4. Either Yellow: Valid pincode entry soon enough cancels the timer and returns the system to the armed state with yellow LED and enabled sensors.
  5. Or Red with siren: Timer timeout turns on the siren.
  6. Yellow: Valid pincode entry turns off the siren and returns to armed state.

Alternate sequence with no sensor trigger event:

  1. Green: Unarmed
  2. Yellow: Valid pincode entry arms the system, turns the LED yellow, and enables sensors.
  3. Green: Valid pincode entry disarms the system, turns the LED green, and disables sensors.

One might white-board the initial conceptual system like this:

images/state_3

After power-up, a valid pincode event can arrive any time at the Controller, whether appropriate or not. Once the Controller enables the sensors, they can trigger events at any moment but possibly never. The LED is configured to be a solid-color green on power-up, yellow when armed, and red whenever there is a sensor-generated alarm active. The Controller starts the timer when a sensor triggers and starts the siren upon timeout. A user must enter a valid pincode to exit the alarm state and to silence the siren if it has begun sounding.


Next: , Up: The Alarm System   [Contents]