← Teacher guide Markdown for Prepare

Name a job: cheat sheet

micro:bit: talk and play · Find each block in the MakeCode toolbox (the category is at the end of each line).

show icon

Shows a ready-made picture. Basic › show icon; click the picture to choose another.

basic.showIcon(IconNames.Heart)
The block

show string

Scrolls a word or message across the screen. Basic › show string.

basic.showString("Hello")
The block

pause

Waits before the next block. 1000 ms is one second. Basic › pause.

basic.pause(500)
The block

on shake

Runs the blocks inside every time the micro:bit is shaken (or tilted, if you choose another gesture). Input.

input.onGesture(Gesture.Shake, function () {
    blocks
})
The block

get value at

The item at a place in the list, counted from 0. Arrays.

answers[0]
The block

function

A named job. Making it does not run it: a call block runs it. Advanced › Functions.

function name () {
    blocks
}
The block

show leds

Draw your own picture: click squares to light them (# is on). Basic › show leds.

basic.showLeds(`
    . # . # .
    # # # # #
    # # # # #
    . # # # .
    . . # . .
    `)
The block

clear screen

Turns every LED off. Basic › more › clear screen.

basic.clearScreen()
The block

on button pressed

Runs the blocks inside every time the button is pressed. Choose A, B or A+B. Input.

input.onButtonPressed(Button.A, function () {
    blocks
})
The block

list

Many values in order under one name. Places start at 0. Advanced › Arrays.

let answers = ["Yes", "No"]
The block

pick random

A random whole number from the first to the second, both included. Math.

randint(0, 10)
The block

shared code

Send a place number; both micro:bits must hold the same list in the same order.

let words = ["Hi", "Yes", "No"]
radio.onReceivedNumber(function (receivedNumber) {
    basic.showString(words[receivedNumber])
})
The block