MakeCode Micro:bit BlockIDs

micro:bit MakeCode — Toolbox Filter Reference
micro:bit Toolbox Filter Reference categories & block IDs for pxt.json > toolboxFilter

Find the right namespace and block ID

Every toolbox category and block from microsoft/pxt-microbit, plus the built-in categories from microsoft/pxt. Click any namespace or block ID to copy it, then drop it into your toolboxFilter.

23Categories
285Block IDs

Basic

Core8 blocks
pxt-microbit
Block IDBlock
show arrow %i=device_arrow
show icon %i
clear screen
forever
pause (ms) %pause
show string %text
show leds
show number %number

Input

Core22 blocks
pxt-microbit
Block IDBlock
acceleration (mg) %NAME
on button %NAME pressed
on %NAME
button %NAME is pressed
light level
magnetic force (µT) %NAME
rotation (°) %NAME
running time (ms)
running time (micros)
sound level
compass heading (°)
on pin %name pressed
pin %NAME is pressed
on pin %NAME released
set accelerometer range %range
temperature (°C)
is %gesture gesture
calibrate compass
on logo $action
logo is pressed
on %sound sound
set %sound sound threshold to %value

Music

Core29 blocks
pxt-microbit
Block IDBlock
%fraction beat
%melody
melody $melody
change tempo by (bpm) %value
%name
play tone %note=device_note for %duration=device_beat
rest for %duration=device_beat
ring tone (Hz) %note=device_note
set tempo to (bpm) %value
start melody %melody=device_builtin_melody repeating %options
stop melody $options
tempo (bpm)
$melody
music on %value
play $toPlay $playbackMode
play $toPlay $playbackMode
set built-in speaker $enabled
sound is playing
stop all sounds
melody $melody at tempo $bpm (bpm)
tone $note for $duration
play melody $melody at tempo $tempo (bpm)
$soundExpression
$soundExpression
$waveShape start frequency $startFrequency end frequency $endFrequency duration $duration start volume $startVolume end volume $endVolume effect $effect interpolation $interpolation
$waveShape start frequency $startFrequency end frequency $endFrequency duration $duration start volume $startVolume end volume $endVolume effect $effect interpolation $interpolation
play sound $sound $mode
volume
set volume %volume

Led

Core12 blocks
pxt-microbit
Block IDBlock
brightness
led enable %on
toggle x %x y %y
plot x %x y %y
plot bar graph of $value up to $high serial write $valueToConsole
plot x %x y %y brightness %brightness
point x %x y %y
point x %x y %y brightness
set brightness %value
stop animation
unplot x %x y %y
set display mode $mode

Radio

Core15 blocks
pxt-microbit
Block IDBlock
radio raise event from source %src=control_event_source_id with value %value=control_event_value_id
radio receive number
radio receive string
radio on data received
radio received signal strength
on radio received
on radio received
on radio received
on radio received
on radio received
radio set frequency band %band
radio set group %ID
radio set transmit power %power
radio write received packet to serial
radio write value to serial

Loops

Core2 blocks
pxt-microbit
Block IDBlock
every $interval ms
%ms

Game

Advanced24 blocks
pxt-microbit
Block IDBlock
add life %lives
change score by %points
create sprite at x: %x y: %y
delete %this(sprite)
game over
is game over
is paused
is running
%sprite move by %leds
pause
remove life %life
resume
score
set life %value
set score %points
%sprite if on edge, bounce
%sprite change %property by %value
is %sprite deleted
%sprite %property
%sprite set %property to %value
is %sprite touching edge
is %sprite touching %other
start countdown (ms) %duration
%sprite turn %direction by (°) %degrees

Images

Advanced7 blocks
pxt-microbit
Block IDBlock
arrow image %i
icon image %i
%arrow
create big image
create image
scroll image %sprite(myImage) with offset %frameoffset and interval (ms) %delay
show image %sprite(myImage) at offset %offset and interval (ms) %interval

Pins

Advanced32 blocks
pxt-microbit
Block IDBlock
analog pin $pin
$pin
$pin
analog pitch %frequency for (ms) %ms
analog pitch volume
analog set pitch pin %name
analog set pitch volume $volume
analog read pin %name
digital read pin %name
analog set period pin %pin to (µs)%micros
analog write pin %name to %value
digital write pin %name to %value
set pin %pin to emit %type events
set pull pin %pin to %pull
servo write pin %name to %value
servo set pulse pin %value to (µs) %micros
set %name to touch mode %mode
digital pin $pin
$pin
i2c write number at address %address with value %value of format %format repeated %repeat
map %value from low %fromLow from high %fromHigh to low %toLow to high %toHigh
neopixel matrix width pin %pin %width
set audio pin $name
set audio pin enabled $enabled
i2c read number at address %address of format %format repeated %repeat
on pin %pin pulsed %pulse
pulse duration (µs)
pulse in (µs) pin %name pulsed %value
spi format bits %bits mode %mode
spi frequency %frequency
spi set pins MOSI %mosi MISO %miso SCK %sck
spi write %value

Serial

Advanced18 blocks
pxt-microbit
Block IDBlock
serial set rx buffer size to $size
serial set tx buffer size to $size
serial set write line padding to $length
%del
serial on data received %delimiters=serial_delimiter_conv
serial read string
serial read line
serial read until %delimiter=serial_delimiter_conv
serial read buffer %length
serial redirect to TX %tx RX %rx at baud rate %rate
serial redirect to USB
serial set baud rate %rate
serial write buffer %buffer=serial_readbuffer
serial write line %text
serial write number %value
serial write numbers %values
serial write string %text
serial write value %name = %value

Control

Advanced13 blocks
pxt-microbit
Block IDBlock
device name
device serial number
%id
event timestamp
event value
%id
run in background
on event from %src=control_event_source_id with value %value=control_event_value_id
raise event from source %src=control_event_source_id with value %value=control_event_value_id
reset
millis (ms)
wait for event from %src with value %value
wait (µs)%micros

Data Logger

Core10 blocks
pxt-microbit
Block IDBlock
$column
column $column value $value
delete log $deleteType
log data $data1 $data2 $data3 $data4 $data5 $data6 $data7 $data8 $data9 $data10
log data array $data
set columns $cols
set columns $col1 $col2 $col3 $col4 $col5 $col6 $col7 $col8 $col9 $col10
set timestamp $format
mirror data to serial $on
on log full

Devices

Core7 blocks
pxt-microbit
Block IDBlock
raise alert to %property
tell camera to %property
on notified %event
on gamepad button %NAME
tell remote control to %property
signal strength
on signal strength changed

Bluetooth

Core19 blocks
pxt-microbit
Block IDBlock
on bluetooth connected
bluetooth on data received %delimiters=serial_delimiter_conv
on bluetooth disconnected
bluetooth set transmit power %power
bluetooth accelerometer service
bluetooth button service
bluetooth io pin service
bluetooth led service
bluetooth magnetometer service
bluetooth temperature service
bluetooth uart service
bluetooth uart write line %data
bluetooth uart read until %del=serial_delimiter_conv
bluetooth uart write string %data
bluetooth uart write number %value
bluetooth uart write value %name = %value
bluetooth advertise UID namespace (bytes 6-9)%ns instance (bytes 2-6)%instance with power %power connectable %connectable
bluetooth advertise url %url with power %power connectable %connectable
bluetooth stop advertising

Audio Recording

Core5 blocks
pxt-microbit
Block IDBlock
audio is $status
play audio clip $mode
set microphone sensitivity to $gain
set sample rate to $hz for $scope
record audio clip $mode

Text

Core1 blocks
pxt-microbit
Block IDBlock
convert $value=math_number to text

Loops

Built-in6 blocks
pxt (core)
Block IDBlock
repeat _ times
while _
for index 0 to _
for index 0 to _ (alt)
for element of _
for element of _ (alt)

Logic

Built-in5 blocks
pxt (core)
Block IDBlock
if / else if / else
_ = _ comparison
_ and/or _
not _
true / false

Math

Built-in11 blocks
pxt (core)
Block IDBlock
numeric literal (shadow)
_ + _
remainder of _ / _
min/max of _ and _
absolute value of _
sqrt/sin/cos/…
round/ceil/floor/trunc
pick random true or false
convert $value from $type
pick random %min to %limit
pick random %min to %limit

Variables

Built-in4 blocks
pxt (core)
Block IDBlock
variable (get)
reporter get
set _ to _
change _ by _

Text

Built-in15 blocks
pxt (core)
Block IDBlock
string literal (shadow)
join strings
length of string
string_concat
char from %this=text at %pos
char code from $this=text at $index
compare %this=text to %that
substring of $this from $start of length $length
%this=text is empty
%this=text find index of %searchValue
%this=text includes %searchValue
split %this=text at %separator
substring of %this=text from %start of length %length
parse to number %text
text from char code %code

Arrays

Built-in17 blocks
pxt (core)
Block IDBlock
create array with…
array get at index
array set at index
length of array
%list add value %value to end
get and remove last value from %list
reverse %list
get and remove first value from %list
%list insert %value at beginning
%list get and remove value at %index
%list insert at %index value %value
%list find index of %value
get random value from %list
%list insert %value at beginning
remove last value from %list
remove first value from %list
%list remove value at %index

Functions

Built-in3 blocks
pxt (core)
Block IDBlock
define function
call function
return value
No blocks match that search.

Using these in pxt.json

Add a toolboxFilter object to your project’s pxt.json. It reads two keys — namespaces (whole categories) and blocks (individual block IDs).

"visible"
Shown normally.
"hidden"
Removed from the toolbox.
"disabled"
Shown but greyed-out.
"toolboxFilter": {
  "namespaces": {
    "logic": "hidden",
    "radio": "hidden",
    "pins": "hidden"
  },
  "blocks": {
    "device_print_message": "hidden",
    "device_show_string": "hidden"
  }
}

Good to know

• A block-level setting overrides the category default for that one block; hiding a namespace removes the whole category.
• An unrecognized value (a typo like "hiden") is silently ignored, leaving the block visible.
• There is no defaultState in pxt.json — list what you want hidden explicitly rather than allow-listing.
• Save it as valid JSON: no // comments and no trailing commas, or the file may fail to parse.

Copied