3. mBot Code Blocks

3.1. Show

The Show code blocks control the LED panel if you have it installed. Typically, the LED panel is installed on port 1.

Show

Block

Effect

00-led-panel-shows-image-for-secs

displays image with duration

01-led-panel-shows-image

displays the specified image

02-led-panel-shows-image-at-x-y

displays image at coordinate

03-led-panel-shows-text

displays the specified string

04-led-panel-shows-text-at-x-y

displays string at coordinate

05-led-panel-shows-number-text

displays the specified number

06-led-panel-shows-time

displays the time

07-led-panel-x-clears-screen

clears the screen

3.2. Light and Sound

Light and Sound

Block

Effect

00-led-shows-color-for-secs

shows color with duration

01-led-shows-color

shows color

02-turn-on-light-with-color-red-green-blue

shows color with red, green and blue amounts

03-play-note-for-x-beats

plays note at beat

04-play-sound-at-frequency-of-hz-for-secs

plays a sound at frequency with duration

3.3. Action

Action

Block

Effect

00-move-forward-at-power-x-for-secs

move forward with duration

01-move-backward-at-power-x-for-secs

move backward with duration

02-turn-left-at-power-x-for-secs

turn left with duration

03-turn-right-at-power-x-for-secs

turn right with duration

04-x-at-power-y

move

05-left-wheel-turns-at-power-x-right-wheel-at-power-y

turn the left and right wheels

06-stop-moving

stop moving

3.4. Sensing

Sensing

Block

Effect

00-light-sensor-light-intensity

toggles light intensity reading

01-ultrasonic-sensor-distance

toggles ultrasonic sensor reading

02-line-follwer-sensor-value

toggles line sensor reading

03-line-follower-sensor-detects-being

line sensor detects color

04-when-on-board-button

onboard button is pressed

05-ir-remote-pressed

button pressed on IR remote

06-send-ir-message-text

sends and IR message

07-ir-message-received

the IR message received

08-timer

toggles timer

09-reset-timer

resets the timer

3.5. Events

Events

Block

Effect

00-when-flag-clicked

when the flag is clicked

01-when-key-pressed

when a key is pressed

02-when-mbot-starts-up

when the robot starts up

03-when-onboard-button-x

when the on-board button is pressed or released

04-when-receive-message

when a message is received

05-broadcast-message

broadcast a message

06-broadcast-message-and-wait

broadcast a message and wait