Skip to Main Content
Save the World with Code: 20 Fun Projects for All Ages Using Raspberry Pi, micro:bit, and Circuit Playground Express
book

Save the World with Code: 20 Fun Projects for All Ages Using Raspberry Pi, micro:bit, and Circuit Playground Express

by Lorraine Underwood
April 2020
Intermediate to advanced content levelIntermediate to advanced
224 pages
6h 2m
English
McGraw-Hill Education TAB
Content preview from Save the World with Code: 20 Fun Projects for All Ages Using Raspberry Pi, micro:bit, and Circuit Playground Express

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Science and Engineering Projects Using the Arduino and Raspberry Pi: Explore STEM Concepts with Microcomputers

Science and Engineering Projects Using the Arduino and Raspberry Pi: Explore STEM Concepts with Microcomputers

Paul Bradt, David Bradt
Card Games by Thiagi: A User's Guide

Card Games by Thiagi: A User's Guide

Sivasailam Thiagi Thiagarajan

Publisher Resources

ISBN: 9781260457605