Theory
📟⚙️ 4. Sensors: Making a Thermometer
Introduction
- Exciting exploration into Micro: bit sensors 🌐
- Covers thermometer, step counter, and compass 🌡️👣🧭
- Dive into sensor capabilities 🕵️♂️
🌡️ Making a thermometer:
- Built-in temperature sensor detects CPU heat 🌡️
- Don’t expose Microbit to extreme temperatures ⚠️
- Create variable ‘level’ in Make Code 💻
- Explore temperature differences indoors/outdoors 🏠🌳
Steps:
- 🛠️ Drag the ‘set level to 0’ block onto your screen. It will show as grey until placed under a basic or input command.
- 🟣 Define the variable by replacing the 0 with ‘temperature’ from the purple input menu.
- 📟 Specify when the action should occur using the ‘on button B pressed’ command. Change A to B and place the ‘set level to temperature’ block underneath.
- 📊 Show the temperature on the screen by dragging a ‘show number’ command from the basic (blue) menu.
- 📏 Replace the 0 with ‘level’ by dragging a ‘level’ command from the red variables menu.
- 🖥️ The final program should resemble this setup.
- 📥 Download program onto Microbit.
- 🌡️ Press B to view temperature in Celsius.
- 🌡️🔆 Compare with household thermometer.
- 🔆🌡️ Run light sensor and temperature sensor together.
🔆🌡️ Program from light sensor + program from temperature sensor:
- 🅰️ Press button A to check light level.
- 🅱️ Press button B to view temperature.
- 📥 Download the program and try it out! Remember, don’t put your Micro: bit in the oven!