Logic in Real-Life
1. Sensors as Logic Inputs
In automated systems, sensors provide the binary input (0 or 1) based on a threshold value. For example:
Temperature:
1 = Too Hot
0 = Normal
1 = Too Hot
0 = Normal
Pressure:
1 = Pressed
0 = Not Pressed
1 = Pressed
0 = Not Pressed
Light:
1 = Dark
0 = Bright
1 = Dark
0 = Bright
Switch:
1 = Closed (On)
0 = Open (Off)
1 = Closed (On)
0 = Open (Off)
2. Worked Scenario: The Safety Alarm
The Problem: A chemical plant needs an alarm (X) to sound if:
- The Temperature (T) is too high (T=1) AND the Pressure (P) is too high (P=1).
- OR if the Emergency Switch (S) is pressed (S=1).
Step 1: Map the Logic
IF (T=1 AND P=1) OR (S=1) THEN X=1
Step 2: Create the Expression
X = (T AND P) OR S
Step 3: The Truth Table
This table shows when the alarm will actually sound based on the sensors:
| T | P | S | X (Alarm) |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 (Switch pressed) |
| 1 | 1 | 0 | 1 (Temp & Press high) |
| 1 | 1 | 1 | 1 (All triggered) |
3. Common Real-Life Examples
- Street Lighting:
Light Sensor (Dark) AND Timer (On)➔ Lamp On. - Bank Vault:
Key 1 (Turned) AND Key 2 (Turned)➔ Door Opens. - Microwave:
Timer (Not 0) AND Door (Closed)➔ Start Cooking.
⚠️ Exam Note: Always read the "Conditions" carefully. Sometimes an exam will say "Alarm sounds if the window is NOT closed." If
Closed = 1, you must use a NOT gate on that input.