Creating and testing a program that uses the temperature sensor.

To create a real-world program using a sensor, input and a conditional statement.
I can use the temperature sensor input on a micro:bit.
I can use a conditional statement to make the micro:bit react to the reading.
I can test my program on a physical device.
Watch
Watch
Explain that the children should recall what they remember about programming using MakeCode.
Display the Presentation: Speak like an expert and arrange the children into pairs. Allow time for them to share their ideas using key vocabulary.
Explain that the children should recall what they remember about programming using MakeCode.
Display the Presentation: Speak like an expert and arrange the children into pairs. Allow time for them to share their ideas using key vocabulary.
Take feedback, highlighting any accurate use of subject-specific terms.
The children may share that:
The code is for a pedometer, which counts how often the micro:bit is shaken.
The 'on shake' input block detects movement and triggers the code.
The variable 'steps' stores and updates the number of steps taken.
A conditional statement (an 'if' block) checks if the step count has reached a specific number (e.g twenty).
When the condition is met, the micro:bit reacts with a celebration, such as showing an icon (e.g a smiley face) or playing a sound.
Hand out the micro:bits with the pre-loaded scoreboard program (see Teacher knowledge) and arrange the children into pairs. Alternatively, load the program onto one micro:bit and complete the quiz as a whole class, inviting volunteers to take turns.
Display the Quiz: Storm the scoreboard and explain that the children will take part in a weather quiz and the micro:bit has been programmed to function as a scoreboard. Assign one child in each pair to be Player A and the other Player B.
Hand out the micro:bits with the pre-loaded scoreboard program (see Teacher knowledge) and arrange the children into pairs. Alternatively, load the program onto one micro:bit and complete the quiz as a whole class, inviting volunteers to take turns.
Display the Quiz: Storm the scoreboard and explain that the children will take part in a weather quiz and the micro:bit has been programmed to function as a scoreboard. Assign one child in each pair to be Player A and the other Player B.
Display the quiz questions one at a time. After each question, click to reveal the correct answer. If a player is correct, they press their assigned button to log the score (button A for Player A and button B for Player B). The first player to reach five correct answers wins.
Ask the children:
Display the Presentation: Scoreboard code explained.
Click to reveal and discuss the function of each block:
Two variables track each player's score.
Pressing button A increases Player A’s score and pressing button B increases Player B’s score.
An 'if condition' displays a message when either player reaches five points.
Pressing both buttons together resets both scores to zero.
Ask the children:
Take the children to the hall or playground in pairs, each with their micro:bit, whiteboard and a pen. Explain that they will test their programs by collecting temperature readings in different areas.
Ask the children to walk to locations such as a window, door, bench or piece of outdoor equipment. Explain that they will press button A (or their chosen input) to check the temperature (displayed on the LED grid) and record it on their whiteboard.
Join two pairs together once they have collected readings. Ask each group to report back like weather forecasters, using phrases such as:
Over by the bench, it is 22 °C.
By the maths display, it is 18 °C.
Ask the children:
Share lessons with your friends and colleagues for free.

Used in 8,390 schools!