GoalChoose the right input for a micro:bit program: a button, both buttons, a shake or the logo.
New words
A+B · pressing both buttons at the same timeshake · moving the board quickly so its sensor can feel itlogo · the touch-sensitive gold mark on newer micro:bit boards
Explanation
Buttons A and B are not the only inputs. You can also press A and B together, shake the board, or touch the logo on newer boards. Each one is a hat block in the Input group, with a drop-down list to choose the button or movement. Choose the input that fits the job. Shaking suits a rattle or a dice. Pressing both buttons suits a special action that nobody does by accident. One program can have several input blocks. Each one starts its own script.
Worked examples
Input
How to make it
A good job for it
button A
press A
start a tune
button B
press B
stop or change a tune
A+B
press both buttons together
a special action
shake
shake the board
a rattle or a dice
logo
touch the gold logo
a surprise
Each input has a way to make it happen and a job it is good for.
A magic wand: when the board is shaken it shows a butterfly and plays the twinkle sound until it is done.
A program can have a script for each input. Press A and the duck appears. Press B and the cow appears. The scripts do not disturb each other.
Class activity
Input charades (in a group): write five cards: press A, press B, press both, shake, touch the logo. Act them out: tap the left shoulder for A, the right shoulder for B, both shoulders for A+B, wiggle your whole body for shake and touch the top of your head for the logo. One player acts, the others call the input. Then add a program card, such as “shake: make a snake with your arm”. When the actor does the input, everyone follows the card. Which input was easiest to do by mistake?
Practice
1
Which input would you choose for a board that works like a rattle?
Shake.
2
You shake the board with this program. Which icon appears?
A ghost, because the shake script shows the ghost.
3
Why can one program have more than one input block?
Each input block starts its own script, so different inputs can make different things happen.
4
You press button A and button B together with the program in question 2. Which script runs?
None of them, because no script starts with A+B. A script starting with button A+B pressed would be needed.