5. Case 03: Thermometer

5.1. Purpose


  • Use the Smart Coding Kit to create a wearable thermometer.

5.2. Materials


  • 1 x smart coding kit

../../_images/smart_coding_kit_case_03_01.png

5.3. Software


MakeCodemakecode

5.4. Programming


Step 1

  • Create a variable flag. Initialize this variable to 0 when we startup our micro:bit.

../../_images/smart_coding_kit_case_03_02.png

Step 2

  • Create a forever loop to show the variable i. If it is over the default value, it alarms; Or it does not alram.

../../_images/smart_coding_kit_case_03_03.png

Step 3

  • When button A being pressed, set the returned value as i displaying on the micro:bit.

../../_images/smart_coding_kit_case_03_04.png

5.5. Result


  • The current value will be detected and displayed on the micro:bit when button A being pressed.

5.6. Exploration


5.7. FAQ


Q: Sometimes the temperature is below 20 degrees, but the value detected is even higher?

A: The temperature detected is the micro:bit chips but not the environment, the chips will get hot obviously when powering on for a long time.

5.8. Relevant File