MISSION 3

Light Sensor to Detect When Vampire Zombies Are Awake

Vampire zombies only come out when it’s dark. Let’s create a light sensor that tells us when it’s dark so that we know when to be on alert.

Algorithm

Images

For the micro:bit, the alarm will be some text across the LEDs. For the Circuit Playground Express, we’ll flash the lights.

SELECTION

In coding, we call the if statement in the above algorithm Selection. If statements are a big part of coding. We use them to check on things. I like to use the example:

Images

In an if statement, you’re checking ...

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.