Micro:bit inputs and jobs
Answers are for parents and teachers.
1
Write the blocks for a game where each shake of the board earns 2 points and shows the score, and button B sets the score back to 0. What does the board show after 3 shakes?
on shake: change score by 2, show number score. on button B pressed: set score to 0, show number score. After 3 shakes the board has shown 2, 4 and 6, so it shows 6.
2
The buttons are pressed in the order A, A, B, A, B, B. List the numbers that the board shows.
coins goes 3 (A), 6 (A), 4 (B), 7 (A), 5 (B) and 3 (B). The board shows 3, 6, 4, 7, 5, 3.
3
Write a plan table (job, input, process, output) for a program that counts people who enter a room. A adds one person, B shows the number and A+B starts again.
Job: count the people in a room. Input: button A, button B, buttons A+B. Process: A adds 1 to people; A+B sets people to 0. Output: show number people when B is pressed (and after A+B).
4
Predict what the board shows for n = 17. Then say what it would show for n = 20 and for n = 9.
17: 17 ≥ 20 is false and 17 ≥ 10 is true, so it shows 17 − 10 = 7. 20: the first condition is true, so it shows yes. 9: both conditions are false, so it shows no.
5
(if you have a computer or tablet) Build the laps counter from this week in a micro:bit simulator. Press A five times, then B. Does it show 2000? Then press A+B.
Five laps are 5 × 400 = 2000 m, so after B the board shows 2000. After A+B it shows 0.