Page 49 - Ai Robogenius
P. 49
BLOCKS IN MICRO:BIT
In Microsoft MakeCode, blocks are the visual elements used to create programs
in a simple, drag-and-drop interface. These blocks represent different commands,
actions and logic that help you build projects without writing complex code.
MakeCode blocks are grouped into categories based on their functions, making
it easy to drag and drop them to create your projects. Here's a breakdown of the
main block elements in Micro:bit:
Basic Blocks
Basic blocks help you control simple actions and output. Some of the important
basic blocks are:
Block Description
Displays a number on the screen.
show number 0
Display patterns or images on the LED
show leds
screen.
Displays a specific icon (e.g., heart,
show icon
smiley face) on the screen.
Displays a text message on the screen.
show string "Hello!"
Clears any text or images on the screen.
clear screen
Repeats the actions inside it
forever
continuously, as long as the program is
running.
Runs the actions inside it once,
on start
immediately when the program starts.
Coding with Micro:Bit
47

