MISSION 20
Window Alarm
When windows are open, heat can escape. But fresh air is nice, even in the cold. We don’t want alarms going off just because a window is open. We just need to make sure that the window isn’t open for too long.
We can use the temperature sensor from Mission 17 and the door sensor from Mission 8 together to accomplish this mission.
Algorithm
We want the alarm to go off if the window is open and the temperature in the house has gone down since the last two readings.
micro:bit
Figure 20.1 Window set up with tinfoil.
Get Save the World with Code: 20 Fun Projects for All Ages Using Raspberry Pi, micro:bit, and Circuit Playground Express now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.