Bbc microbit Lesson 3 – Temperature hot medium
temperature You will learn how to get the ambient temperature (degree Celsius °C). The temperature is inferred from the the surface temperature of the various chips on the micro:bit. We will be learning how to get the temperature using on shake, local variables, as well as simple commands such as show number.
Temperature
Temperature First setup the variable temp and set it to 0, here we are telling the Micro:bit that the variable is a integer data type. Can you remember what that means? You then need to insert an input this can be shake or on button pressed.
Temperature Setup the input so that our Microbit will work out what the temperature is when you shake or press a button, this will then be stored in the temp variable. Finally ask your Micro:bit to show the temperature by inserting the show number code and linking it to the variable temp.
Temperature Run your code to see what happens, move around the room to see if the temperature changes. You should now know how to put files onto your Micro:bit.
Temperature Extension Challenge 1 – Add 1 IF statement to your code so that IF the temperature is more than (>) 26 your Micro:bit displays ITS HOT! Add 1 Else IF statement to your code so that IF the temperature is less than (<) 17 your Micro:bit displays ITS COLD! Add 1 Else statement to your code so that Else the Micro:bit displays GOOD TEMPERATURE.
Temperature Challenge 2 – Add images to display to your screen a Celsius sign.