To create a new script, go to the Create Code
page and tap
Welcome! This activity will teach how to measure the temperature on the micro:bit. Let's get started!
We want to display the temperature on shake. In order to do so, we need to register the event
on shake that will execute whenever the user shakes the BBC micro:bit; in the web browser, click the button labelled "SHAKE" under the simulator to generate a shake event
Let's measure the temperature and then store in it a variable
temp. The temperature is measured in Celsius, so a value of
29 is equivalent to 29 degrees Celsius.
Show the value of
temp on the screen.
- click run to see if the code works as expected.
Excellent, you're ready to continue with the challenges