show number
Shows a number; numbers above 9 scroll. Basic › show number.
basic.showNumber(0)
Secret messages · Find each block in the MakeCode toolbox (the category is at the end of each line).
Shows a number; numbers above 9 scroll. Basic › show number.
basic.showNumber(0)
Adds to a variable's value. Change by -1 counts down. Variables.
count += 1
Runs each time a number arrives; receivedNumber holds it. Radio.
radio.onReceivedNumber(function (receivedNumber) {
blocks
})
The place where something first appears in a text, counted from 0, or -1 if it is not there. Text (find index of … in …).
alphabet.indexOf(letter)
XOR: compares two numbers bit by bit. Doing it again with the same key brings the number back, so one key locks and unlocks. Written ^ in JavaScript and Python.
message ^ key
Puts a value in a variable, throwing the old value away. Make the variable in Variables first.
let count = 0
Sends a number to every other micro:bit in the group. Radio.
radio.sendNumber(0)
One on radio received gets every message; receivedNumber says which one arrived.
radio.onReceivedNumber(function (receivedNumber) {
if (receivedNumber == 1) {
blocks
} else if (receivedNumber == 2) {
blocks
}
})
What is left over after dividing: 27 % 26 is 1. Wraps a count back round to the start. Math (remainder of … ÷ …).
place % 26