Micro:bit – Temperature Sensor

Use the Micro:bit’s onboard temperature sensor to record changes during flight.

Instructions

  1. In MakeCode, create a variable called temp.
  2. Read input.temperature() every second and radio the value.
  3. Display readings when on the ground.

Code

radio.setGroup(2)
basic.forever(function () {
  let temp = input.temperature()
  radio.sendValue("temp", temp)
  basic.pause(1000)
})
radio.onReceivedValue(function (name, value) {
  basic.showNumber(value)
})

Extension

Compare inside-rocket vs outside-rocket readings by running two devices simultaneously.