GoalSay which group each micro:bit block comes from and build a program in the right order.
New words
block editor · a free program for making micro:bit programs by joining blocksblock group · a set of blocks of the same kind, such as Input, Basic or Loopsdownload · to send a finished program from the computer to the board
Explanation
In a micro:bit block editor you build programs by joining blocks. Blocks are kept in groups. The Input group has blocks for buttons, shaking and the logo. The Basic group has show icon, show leds, show number, pause and clear screen. The Loops group has repeat. The Music group has play sound. The Led group has set brightness, and the Math group has pick random. A new project already has two blocks, on start and forever. Delete them if you do not need them. Build the program one block at a time and test it in the simulator. An adult can help to download it to the real board.
Block
Group
on button A pressed
Input
repeat (6) times
Loops
show leds
Basic
pause (ms)
Basic
clear screen
Basic
play sound until done
Music
Worked examples
The turn-left algorithm from last week as micro:bit blocks. The button block is the input, so it goes first. The repeat block goes inside it, and the show, pause and clear blocks go inside the repeat block. A pause of 500 ms is half a second.
Order
Group
Block
1
Input
on button A pressed
2
Loops
repeat (6) times
3
Basic
show leds (draw the arrow)
4
Basic
pause (ms) 500
5
Basic
clear screen
6
Basic
pause (ms) 500
Build the program in this order. Test it in the simulator after the last block: press A and count 6 flashes.
Block
Group
on shake
Input
show number
Basic
show string
Basic
pick random 1 to 6
Math
set brightness
Led
Other useful blocks and where to find them.
Class activity
Block cards (with family): write each block on a small card: on button B pressed, repeat 3 times, show leds (square), pause 2000 ms, clear screen, pause 1000 ms. Mix them up. Another person puts the cards in the right order to make the stop program from last week. Read the program out loud as an algorithm. Then change it so that the square flashes 5 times with button A. Which cards did you have to change?
Practice
1
Which group does each block come from: A on shake, B pause, C repeat, D play sound?
Block
Group
A on shake
?
B pause
?
C repeat
?
D play sound
?
A Input, B Basic, C Loops, D Music.
2
Put these blocks in the order that you would add them to the project: A show icon, B on button B pressed, C clear screen, D repeat (2) times.
B, D, A, C.
3
What happens when button B is pressed? How many seconds of waiting are there in all?
The no icon is shown for 1 second and then cleared, 2 times in all. The waiting is 1 × 2 = 2 seconds.
4
Your program does not do what you expected in the simulator. What should you do?
Compare the blocks with your algorithm step by step, find the block that is wrong or in the wrong place, fix it and test again.