It is often required for an electronic system to respond to changing environmental factors automatically. For example
Bulbs are required to come on automatically in the dark and switch off automatically when light returns.
An alarm is required to sound when moisture is detected or a circuit is broken to indicate a burglary.
When the temperature rises above a certain level a motor in a fridge is required to tuen on to pump refrigerant around the system, an alarm is required to go off to indicate fire or a fan is required to start.
A heater is required to switch on when the temperature falls below a certain point.
In fact the controlling factor may be almost anything – angle of tilt, magnetic field, sound level, speed, force, pressure, electrical resistance, current or voltage. The principle remains the same however. A sensor detects when a factor reaches a threshold level and changes an output from a set of logic gates. The output is sent to an output circuit where the heater or alarm or bulb is activated or deactivated as required.
This sort of system is very reliable and can be activated repeatedly. After each activation, a reset button can be pressed to put the sytem back into it's original state where it is acting for a change of input from the logic gates.