MISSION 18

Temperature Monitor

A lot of energy is created, spent, and wasted on heating our homes. Don’t get me wrong, we need heat, and I love a nice cosy house. Sometimes, though, my house is too hot, and I’m wasting energy. Let’s set up a temperature sensor to get an idea of what temperature your house actually is.

Instead of displaying the current temperature, let’s record the temperature every hour and store it in an array. Then we can do some science with it!

ARRAY

An array is like a list. You can store numbers in an array and pull them out later. So instead of having variables temperature1, temperature2, and temperature3, we have an array called temperatures that stores all those numbers inside it. The great thing about an array in ...

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 live online training, plus books, videos, and digital content from nearly 200 publishers.