← Teacher guide Markdown for Prepare

Time: cheat sheet

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

show number

Shows a number; numbers above 9 scroll. Basic › show number.

basic.showNumber(0)
The block

animation

Pictures inside forever repeat, in order. Each pause holds the picture before it.

basic.forever(function () {
    basic.showIcon(IconNames.Heart)
    basic.pause(500)
    basic.showIcon(IconNames.SmallHeart)
    basic.pause(500)
})
The block

true or false

A variable can hold true or false, to remember what is happening now. Logic.

waiting = true
The block

forever

Runs the blocks inside again and again. Blocks in on start run only once.

basic.forever(function () {
    blocks
})
The block

running time

Milliseconds since the micro:bit switched on. Take one from a later one to time something. Input › more.

input.runningTime()
The block

time it

Store running time at the start; later, running time − start is how long it took (ms).

start = input.runningTime()
basic.showNumber(input.runningTime() - start)
The block