Reading the micro:bit temperature with input.temperature()
A micro:bit block that returns the temperature reading in degrees Celsius as a number. You can show it with basic.showNumber() or store it in a variable.
Understanding Reading the micro:bit temperature with input.temperature() in ACARA Digital Technologies Years 7–8
What it does: input.lightLevel() is another built-in sensor that returns a number, and basic.showNumber() can display it just like the temperature. The micro:bit reports temperature in degrees Celsius (°C). Without quotes, the code runs and saves the number. With quotes it is just text and no reading is taken. It returns a numeric reading, so you can show it, store it or compare it, for example temp > 25. The variable temp holds the reading, so pass it to basic.showNumber(). The second option is missing the brackets. The brackets () are needed so the block runs and returns the reading. Code is case and spelling sensitive, so a misspelt name is not recognised as the temperature block.
Common mistakes: The variable is called temp, but the broken line uses tmp, which was never created. It should be basic.showNumber(temp). temp is a variable holding a number, not a function, so it has no brackets after it. It should be basic.showNumber(temp).
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 204–236) and word search (Modules 189–236).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
input.temperature()Fill in the Blanks
Spot the Error
Student with a class code? Join your class →