Events Are Everywhere Now that you know what an event is — something that happens that a program notices and responds to — let us look around. Events are not just in computers and phones. They are in everything around you. Once you learn to spot them, you will never stop seeing them. In Your Home The Smoke Alarm A smoke alarm sits on the ceiling, doing nothing — until a certain amount of smoke particles enter the air. --- --- Event Smoke particles exceed safe level Trigger Smoke sensor detects particles in the air Response Alarm sounds loudly The smoke alarm is always watching. It never stops watching. Until the event occurs, it does nothing visible at all — but the moment smoke appears, it responds immediately. Did you know? Many smoke alarms contain a tiny speck of a radioactive metal called americium. It makes a very small electric current flow through the air inside the alarm. Smoke particles get in the way and the current drops — and that drop is the event the alarm is listening for. The Refrigerator Temperature Sensor Your fridge keeps food cold without you thinking about it. Inside, a temperature sensor monitors the temperature constantly. --- --- Event Temperature rises above target (e.g. 4°C) Trigger The temperature sensor reading goes too high Response The compressor switches on to cool things down When it is cold enough again, another event fires: temperature is back at target → compressor switches off. In Your City Automatic Doors You walk towards the entrance of a supermarket. The doors slide open before you even reach them. --- --- Event Motion detected within a certain distance Trigger Motion or pressure sensor detects a person approaching Response Door motor activates, doors slide open When you walk away, another event: no motion detected for 3 seconds → doors slide closed. Traffic Lights at Night Some traffic lights behave differently at night. Instead of cycling red → yellow → green endlessly, they switch to a simple blinking yellow (caution mode). --- --- Event Clock reaches 23:59 (midnight) Trigger A timer inside the traffic signal system Response Switch from full cycling mode to blinking yellow mode At 06:00, another event fires and the full cycle resumes. No one presses a button — the event is time itself. In Your Devices Phone Notifications Your phone is in your pocket, screen off. Suddenly it vibrates. A message arrived. --- --- Event New message received Trigger The phone's messaging system detected incoming data Response Screen lights up, phone vibrates, notification sound plays You did not do anything. The event came from outside — from your friend sending a message — and the phone responded. Low Battery Warning --- --- Event Battery level drops to 20% Trigger Battery sensor reading hits the threshold Response Warning notification appears on screen Events Can Chain Together Here is something interesting: one event's response can itself cause another event. Smoke alarm example, extended: 1. Event: Smoke detected → Response: Alarm sounds 2. Event: Alarm sounds → Response: Smart home system sends a notification to your phone 3. Event: You receive the notification → Response: You open the app and check the camera The first event triggered the second, which triggered the third. Events chaining into each other is how complex systems work — each response can be a new trigger. The Pattern of Every Event By now you can see that every event follows the same structure: Trigger (what causes the event) → Event (the thing that happens) → Response (what the program does) Device Trigger Event Response --- --- --- --- Doorbell Button pressed Electrical circuit closes Bell rings Smoke alarm Smoke detected Sensor threshold crossed Alarm sounds Phone Message received Data arrives Notification displayed Fridge Temperature rises Threshold exceeded Compressor starts Automatic door Person approaches Motion detected Door opens 🎯 Try This Yourself The Chain Reaction You are going to build an event chain you can actually push over. You need a clear table or floor and a pile of ordinary objects: dominoes, coins stood on their edge, a ruler, a marble, a book, an empty cup. 1. Build a chain of at least five steps, where each thing sets off the next one. A marble rolls down a ruler, knocks a line of coins, the last coin tips a book, the book pushes a cup off the edge. 2. Before you push anything, write each step on paper as Trigger → Event → Response . For step one that might be: my finger pushes the marble → the marble starts rolling → it reaches the coins . 3. Push the first thing. Watch. 4. It will almost certainly stop somewhere. Find the exact step where it stopped and fix only that step . Do not rebuild the whole thing. 5. Run it again. Repeat until the chain makes it all the way to the end. What to watch for: every response became the next trigger — that is an event chain. And notice how it failed: never everywhere at once, always at one weak link where the response was not strong enough to set off the…