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.
- Green: unarmed.
- Yellow: Valid pincode entry arms the system, turns the LED yellow and enables sensors.
- Red: A sensor trigger disables the sensors and turns the LED red.
- Either Yellow: Valid pincode entry soon enough cancels the timer and returns the system to the armed state with yellow LED and enabled sensors.
- Or Red with siren: Timer timeout turns on the siren.
- Yellow: Valid pincode entry turns off the siren and returns to armed state.
Alternate sequence with no sensor trigger event:
- Green: Unarmed
- Yellow: Valid pincode entry arms the system, turns the LED yellow, and enables sensors.
- Green: Valid pincode entry disarms the system, turns the LED green, and disables sensors.
One might white-board the initial conceptual system like this:
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.