Introduction

CyberPi is a main control board developed independently by Makeblock. With the compact structure and built-in interfaces, it can be easily extended. It supports mBlock 5 and mBlock-Python Editor; is applicable to multiple education scenarios including large-class teaching, community teaching, and online/offline education & training; covers multiple teaching fields including coding, makers, and robots; and thus can meet the diversified education needs, such as AI, IoT, data science, and UI design.

CyberPi (device) - 图4

Start programming

  1. Use a Type-C USB data cable to connect CyberPi to your computer.

CyberPi (device) - 图5

  1. In mBlock 5, click + add to add CyberPi from the device library.

CyberPi (device) - 图6

  1. Click Connect to connect your CyberPi to mBlock 5.

CyberPi (device) - 图7

After your CyberPi is connected, mBlock 5 displays a message indicating successful
connection.

CyberPi (device) - 图8

  1. Choose a program execution mode, Live or Upload.
    mBlock 5 provides two program execution modes, Live and Upload. You can click to switch to modes.

CyberPi (device) - 图9

Upload mode: In Upload mode, you need to upload the compiled program to the device. After being successfully uploaded, the program can still run properly on the device when the device is disconnected from mBlock 5.

Live mode: In Live mode, you can view the program execution effect in real time, which facilitates the debugging of the program. In this mode, you must keep the device connected to mBlock 5. If they are disconnected, the program cannot be executed.

Now, you can start to have fun with programming!

Add extensions

CyberPi supports abundant extensions, including various mBuild sensors, upload mode broadcast. Click + extension in the blocks area to add an extension from the extension center.

CyberPi (device) - 图10

More help

For the user manual of CyberPi series products and operation guide of CyberPi, see CyberPi Series User Manual and CyberPi Operation Guide.


2. play[file_name]until done

play-until-done.png

Plays the specified sound until the playing ends

How to Use

When this block is executed, the subsequent blocks are executed after the playing ends.
Click to select the sound to be played from the drop-down list box.

CyberPi (device) - 图12

Example

CyberPi (device) - 图13

When you press the space key, CyberPi says “Hi” and then lights up the LEDs.


3. play[file_name]

play-file.png

Plays the specified sound

How to Use

Click to select the sound to be played from the drop-down list box.

CyberPi (device) - 图15

Example

CyberPi (device) - 图16

When you press the space key, CyberPi says “Hi” while lighting up the LEDs.


4. start recording

CyberPi (device) - 图17

Starts to record sounds

How to use

When this block is executed, CyberPi starts to record sounds until the stop recording block is executed or the recording exceeds 10 seconds. The recorded file is stored in RAM, and so the recorded file is lost if CyberPi is power off.

Example

CyberPi (device) - 图18

In Live mode, press the space key, and then press button A on CyberPi to record sounds; press button B to stop the recording; and move the joystick down to play the sounds recorded.


5. stop recording

CyberPi (device) - 图19

Stops the recording

How to use

This block needs to be used in combination with the start recording block.
When it is executed, CyberPi stops the recording.

Example

CyberPi (device) - 图20

In Live mode, press the space key, and then press button A on CyberPi to record sounds; press button B to stop the recording; and move the joystick down to play the sounds recorded.


6. play recording until done

CyberPi (device) - 图21

Plays the recorded sounds until the playing ends

How to use

When this block is executed, the subsequent blocks are executed after the playing ends.

Example

CyberPi (device) - 图22

In Live mode, press the space key, and then press button A on CyberPi to record sounds; press button B to stop the recording; and move the joystick down to play the sounds recorded. After the playing ends, the prompt sound is played.


7. play recording

CyberPi (device) - 图23

Plays the recorded sounds

How to use

When this block is executed, CyberPi plays the recorded sounds.

Example

CyberPi (device) - 图24

In Live mode, press the space key, and then press button A on CyberPi to record sounds; press button B to stop the recording; and move the joystick down to play the sounds recorded.


8. play note[number_1]for[number_2]beat

CyberPi (device) - 图25

Plays the specified piano note for the specified beats

How to use

You can use this block to compile and play music. When this block is executed, the subsequent blocks are executed after the playing ends.
note: frequency of the sound to be played, set by using Musical Instrument Digital Interface (MIDI) codes.
Setting range: 0–132
The following figure shows the relationship between MIDI codes and notes.

CyberPi (device) - 图26

beat: duration a note is to be played
Setting range: beat > 0
At general playing speed, one beat equals one second.

Example

CyberPi (device) - 图27

In Live mode, when you press the space key, CyberPi plays the piano note.
For more details, see the example “Twinkle, Twinkle, Little Start” in mBlock 5.


9. play[fieldMenu_1]for [number_3]beat

play-for-beat.png

Plays the specified sound for the specified beats

How to use

Click to select a sound.

CyberPi (device) - 图29

beat: duration a sound is to be played
Setting range: beat > 0
At general playing speed, one beat equals one second.

Example

CyberPi (device) - 图30

In Live mode, when you press the space key, CyberPi plays the sound of snare.


10. increase audio speed by [number_1]%

CyberPi (device) - 图31

Changes the playing speed of CyberPi’s speaker

How to use

Click to set the percentage by which the playing speed is to be changed, where the percentage refers to the percentage of the normal playing speed.

The value you set must be an integer. A negative value indicates decreasing, and a positive one indicatesincreasing.

Example

CyberPi (device) - 图32

In Live mode, after you press the space key, CyberPi plays the piano note twice, and the playing speed for the second time is higher.


11. set audio speed to[number_1]%

CyberPi (device) - 图33

Sets the playing speed of CyberPi’s speaker

How to use

Click to set the playing speed of the speaker.

The value you set indicates the percentage of the normal playing speed.

Setting range: 25–400 (%)

Example

CyberPi (device) - 图34

In Live mode, after you press the space key, CyberPi plays the piano note twice, and the playing speed for the second time is higher.


12. audio speed

CyberPi (device) - 图35

Reports the current playing speed of CyberPi’s speaker

How to use

You can select the check box on the left of this block to see the playing speed on the stage.

The value 100 (%) indicates the normal playing speed.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图36

Use this block in combination with a Display block.
In Live mode, when you press the space key, CyberPi displays the playing speed in the center of its screen.


13. increase volume by[number_1] %

CyberPi (device) - 图37

Changes the playing volume of CyberPi’s speaker

How to use

Click to set the percentage by which the volume is to be changed.

The value you set must be an integer. A negative value indicates decreasing, and a positive one indicates increasing.

Setting range: –100–+100 (%)

Example

CyberPi (device) - 图38

In Live mode, after you press the space key, CyberPi plays the piano note twice, and the playing volume for the second time is higher.


14. set volume to[number_1] %

CyberPi (device) - 图39

Sets the playing volume of CyberPi’s speaker

How to use

Click to set the playing volume of the speaker.

Setting range: 0–100 (%)

Example

CyberPi (device) - 图40

In Live mode, after you press the space key, CyberPi plays the piano note twice, and the playing volume for the second time is higher.


15. volume(%)

CyberPi (device) - 图41

Reports the current playing volume of CyberPi’s speaker

How to use

You can select the check box on the left of this block to see the playing volume on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图42

Use this block in combination with a Display block.
In Live mode, when you press the space key, CyberPi displays the playing volume in the center of its screen.


16. play buzzer at [number_1]Hz for [number_2]secs

CyberPi (device) - 图43

Plays a sound at the specified frequency for the specified period

How to use

Click to set the frequency and time.

Setting range of the frequency: 20–5000 Hz

To protect your ears, no sound is made if the frequency is out of the range. Your ears may get hurt if you listen to high-frequency sounds for a long period.

You can also change music by setting the frequency, refer to the notes and their corresponding frequencies, as shown in the following figure.

CyberPi (device) - 图44

Example

CyberPi (device) - 图45

In Live mode, when you press the space key, CyberPi plays a sound for one second, and then lights up the on-board LEDs.


17. play buzzer at [number_2]Hz

CyberPi (device) - 图46

Plays a sound at the specified frequency

How to use

Click to set the frequency.

Setting range of the frequency: 20–5000 Hz

To protect your ears, no sound is made if the frequency is out of the range. Your ears may get hurt if you listen to high-frequency sounds for a long period.

You can also change music by setting the frequency, refer to the notes and their corresponding frequencies, as shown in the following figure.

CyberPi (device) - 图47

Example

CyberPi (device) - 图48

In Live mode, when you press the space key, CyberPi plays a sound and lights up the on-board LEDs at the same time, and the playing of the sound stops only after you press button A on CyberPi.


18. stop all sounds

CyberPi (device) - 图49

Stops the playing of all sounds

How to use

This block is used to stop all the sounds played by CyberPi’s speaker.

Example

CyberPi (device) - 图50

In Live mode, when you press the space key, CyberPi keeps making a sound; and when you press the arrow key ↑, CyberPi stops all the sounds.


19. play LED animation[LED_animation]until done

CyberPi (device) - 图51

Displays the specifid LED animation until the display ends

How to use

When this block is executed, the subsequent blocks are executed after the display ends.

Click to select an LED animation from the drop-down list box.

CyberPi (device) - 图52

Example

CyberPi (device) - 图53

In Live mode, when you press the space key, the LEDs on CyberPi display the entire rainbow animation.


20. display[ledRing]

CyberPi (device) - 图54

Lights up CyberPi’s on-board LEDs in the specified color(s)

How to use

Click to set the color(s) of the LEDs.
Select a color and then click an LED.
The LED is set to the selected color.

CyberPi (device) - 图55

Example

CyberPi (device) - 图56

In Live mode, when you press the space key, the LEDs on CyberPi are lit up in orange.


21. roll[led_number]LEDs rightwards

CyberPi (device) - 图57

Makes the colors of the LEDs roll from left to right by the specified number of positions

How to use

CyberPi is equipped with five LEDs, and each is assigned a position.

Setting range: –4 to +4

Example

CyberPi (device) - 图58

In Live mode, when you press the space key, the LEDs are lit up in the colors you set; and then when you press button A on CyberPi, the colors of the LEDs roll from left to right by one position.


22. LED[fieldMenu_1]displays [color_1]for [number_3]secs

led-display-color-for.png

Lights up the specified LED(s) in the specified color for the specified period

How to use

Click to set the LED(s), color, and time.
You can select all LEDs or one specified LED. The numbers 1 to 5 indicate the positions of the LEDs, as shown in the following figure.

CyberPi (device) - 图60

Example

CyberPi (device) - 图61

In Live mode, when you press the space key, the first LED on CyberPi is lit up in red for one second.


23. LED[fieldMenu_1]displays[color_1]

led-display-color.png

Lights up the specified LED(s) in the specified color

How to use

Click to set the LED(s) and color.
You can select all LEDs or one specified LED. The numbers 1 to 5 indicate the positions of the LEDs, as shown in the following figure.

CyberPi (device) - 图63

Example

CyberPi (device) - 图64

In Live mode, when you press the space key, the first LED on CyberPi is lit up in red.


24. LED[fieldMenu_1]displays R[r] G[g] B[b] for[number_5]secs

led-display-rgb-for.png

Lights up the specified LED(s) in the specified color that is the combination of the specified intensity of red, green, and blue for the specified period

How to Use

Click to set the LED(s), color, and time.
You can select all LEDs or one specified LED. The numbers 1 to 5 indicate the positions of the LEDs, as shown in the following figure.

CyberPi (device) - 图66

Intensity range of red, green, and blue: 0–255

Example

CyberPi (device) - 图67

In Live mode, when you press the space key, all the LEDs on CyberPi are lit up in red for one second.


25. LED[fieldMenu_1]displays R [r] G [g] B [b]

led-display-rgb.png

Lights up the specified LED(s) in the specified color that is the combination of the specified intensity of red, green, and blue

How to Use

Click to set the LED(s) and color.
You can select all LEDs or one specified LED. The numbers 1 to 5 indicate the positions of the LEDs, as shown in the following figure.

CyberPi (device) - 图69

Intensity range of red, green, and blue: 0–255

Example

CyberPi (device) - 图70

In Live mode, when you press the space key, all the LEDs on CyberPi are lit up in red.


26. increase LED brightness by [number_1] %

CyberPi (device) - 图71

Changes the brightness of CyberPi’s LEDs

How to use

Click to set the percentage by which the brightness is to be changed.

The value you set must be an integer. A negative value indicates decreasing, and a positive one indicates increasing.

Setting range: –100–+100 (%)

Example

CyberPi (device) - 图72

In Live mode, after you press the space key, the LEDs onCyberPi are lit up in the specified colors, and the brightness increases in one second.


27. set brightness to [number_1] %

CyberPi (device) - 图73

Sets the brightness of CyberPi’s LEDs

How to use

Click to set the brightness of the LEDs.

Setting range: 0–100 (%)

Example

CyberPi (device) - 图74

In Live mode, after you press the space key, the LEDs onCyberPi are lit up in the specified colors, and the brightness increases in one second.


28. turn off LED[fieldMenu_1]

turn-off-led.png

Turns off the specified LED(s) on CyberPi

How to use

This block is used to turn off the specified LED(s) on CyberPi.
You can select all LEDs or one specified LED. The numbers 1 to 5 indicate the positions of the LEDs, as shown in the following figure.

CyberPi (device) - 图76

Example

CyberPi (device) - 图77

In Live mode, when you press the space key, the LEDs on CyberPi are lit up in the specified colors; and when you press the arrow key ↑, all the LEDs go out.


29. LED brightness(%)

CyberPi (device) - 图78

Reports the current brightness of CyberPi’s LEDs

How to use

You can select the check box on the left of this block to see the brightness on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图79

Use this block in combination with a Display block.
In Live mode, when you press the space key, CyberPi displays the brightness of the LEDs in the center of its screen.


30. print[string_2] and move to a newline

CyberPi (device) - 图80

Displays texts on CyberPi’s screen with forced line breaks

How to use

Click to input the text to be displayed.
When this block is executed, a forced line break is inserted after the current text is displayed, and the next text is displayed on a new line.

Example

CyberPi (device) - 图81

In Live mode, when you press the space key, the texts are displayed on CyberPi’s screen with forced line breaks, as shown in the following figure.

CyberPi (device) - 图82


31. print[string_2]

CyberPi (device) - 图83

Displays texts on CyberPi’s screen with automatic line breaks

How to use

Click to input the text to be displayed.
When this block is executed, texts are displayed on the same line, and when a line is full, the texts are continued on new lines.

Example

CyberPi (device) - 图84

In Live mode, when you press the space key, the texts are displayed on CyberPi’s screen with automatic line breaks, as shown in the following figure.

CyberPi (device) - 图85


32. set print size to [inputMenu_1]

mblock_block_1626069961970.png

Displays the specified text at the specified size on the screen of CyberPi

How to use

Click to select a font size from the drop-down list box.

Example

image.png
After you press the space key, CyberPi displays “makeblock”, and one second later, CyberPi displays “makeblock” in two lines and the size of all the texts are enlarged.
Note: CyberPi can’t display texts at two different sizes at a time.


33. show label [fieldMenu_1] [string_2] at [fieldMenu_2] by[inputMenu_4]pixel

show-at-by.png

Displays the specified text at the specified size in the specified position

How to use

You can display multiple texts on the screen by setting labels for them. A maximum of eight texts can be displayed.
Click to select a label, position, and font size from the drop-down list boxes, and enter a text.

Examples

Example 1

CyberPi (device) - 图89
After you press the space key, makeblock is displayed on the screen and disappears in one second, and then hello is displayed.

Example 2

CyberPi (device) - 图90

After you press the space key, makeblock is displayed on the screen, and one second later, hello is also displayed.


34. show label [fieldMenu_1] [string_2]at x[number_2] y[number_3]by[inputMenu_4]pixel

display-xy.png

Displays the specified text at the specified size in the specified position (x,y)

How to use

You can display multiple texts on the screen by setting labels for them. A maximum of eight texts can be displayed.
Click to select a label and font size from the drop-down list boxes, and enter a text and the coordinates.
Note: The anchor point of the text is the top-left point, and therefore the coordinates you set is those of the top-left point of the text.

Examples

Example 1

CyberPi (device) - 图92
After you press the space key, makeblock is displayed on the screen and disappears in one second, and then hello is displayed.

Example 2

CyberPi (device) - 图93
After you press the space key, makeblock is displayed on the screen, and one second later, hello is also displayed.


35. line chart, add data[number_1]

CyberPi (device) - 图94

Adds a piece of data and displays a line chart on CyberPi’s screen

How to use

Data setting range: 0–100

If a value to be input exceeds the setting range, rescale all the original data to be within the setting range.
For example, you can rescale the values 200, 300, and 400 to 20, 30, and 40, respectively.

This block is used to add one piece of data at a time. You can use this block multiple times to add multiple pieces of data.

Example

In Live mode, when you press the space key, a line chart is displayed on CyberPi’s screen.


36. line chart, set spacing to [number_3] pixel

CyberPi (device) - 图95

Sets the spacing between data points in a line chart

How to use

Spacing setting range: 0–128

For example, the following figures show the line charts with the same data but different data point spacings.

CyberPi (device) - 图96

Example

CyberPi (device) - 图97

In Live mode, when you press the space key, a line chart is displayed on CyberPi’s screen.
You can change the shape of the line chart by changing the spacing.


37. bar chart, add data[number_1]

CyberPi (device) - 图98

Adds a piece of data and displays a bar chart on CyberPi’s screen

How to use

Data setting range: 0–100

If a value to be input exceeds the setting range, rescale all the original data to be within the setting range.
For example, you can rescale the values 200, 300, and 400 to 20, 30, and 40, respectively.

This block is used to add one piece of data at a time. You can use this block multiple times to add multiple pieces of data.

Note: To add multiple pieces of data in a bar chart, you need to set multiple brush colors to draw multiple data bars.

Example

CyberPi (device) - 图99

In Live mode, when you press the space key, a bar chart with two data bars is displayed on CyberPi’s screen.


38. table, input[string_3] at row[fieldMenu_1], column[fieldMenu_2]

table.png

Adds a piece of data and displays a table on CyberPi’s screen

How to use

A maximum table of 4 (rows) × 3 (columns) is supported.

Click to set the row, column, and the content to be input.
Define a cell by setting the row and column.

When the content to be displayed in a cell is too long, it keeps scrolling to the right in the cell.

You can input texts into the table.

Example

CyberPi (device) - 图101

In Live mode, when you press the space key, a 4 × 2 table is displayed on CyberPi’s screen.


39. set brush color[color_1]

CyberPi (device) - 图102

Sets the color of the brush

How to use

The brush here is used to draw line charts, bar charts, and tables. By setting the color of the brush, you can draw a line chart with different colors of lines, a bar chart with differnt colors of columns, and a table with the specified font color.

Click to set the color of the brush.

Example

Example 1

CyberPi (device) - 图103

In Live mode, when you press the space key, a line chart with two different colors of lines is displayed on CyberPi’s screen.

Example 2

CyberPi (device) - 图104

In Live mode, when you press the space key, a bar chart with four different colors of bars is displayed on CyberPi’s screen.

Example 3

CyberPi (device) - 图105

In Live mode, when you press the space key, a table with the font color of red is displayed on CyberPi’s screen.


40. set brush color to R [number_1] G [number_2] B [number_3]

CyberPi (device) - 图106

Sets the brush to the color that is the combination of the specified intensity of red, green, and blue

How to use

The brush here is used to draw line charts, bar charts, and tables. By setting the color of the brush, you can draw a line chart with different colors of lines, a bar chart with differnt colors of columns, and a table with the specified font color.

Click to set the intensity of red, green, and blue.
Intensity setting range: 0–255

Example

CyberPi (device) - 图107

In Live mode, when you press the space key, a bar chart with four different colors of bars is displayed on CyberPi’s screen.


41. screen towards[fieldMenu_1]
mblock_block_1626056286227.png

Sets CyberPi’s screen to the specified displaying direction

How to use

With this block, you can rotate the displaying direction of CyberPi’s screen. Four direciton options are provided, as shown in the following:

CyberPi (device) - 图109

Example

CyberPi (device) - 图110

In Live mode, when you press the space key, CyberPi displays “Hello” on its screen, as shown in the following figure.


42. clear screen

CyberPi (device) - 图111

Clears CyberPi’s screen

How to use

To display information on CyberPi’s screen, you need to use this block to clear the screen first. Otherwise, the information may be superimposed on the information displayed before.

Example

CyberPi (device) - 图112

In Live mode, when you press the space key, CyberPi displays “makeblock” on its screen and then clears the screen before displaying “Hello.”


43. control[spriteMenu_1]to follow CyberPi with sensitivity[GRADE]
mblock_block_1626056195371.png

Makes the specified sprite follow CyberPi with the specified sensitivity

How to use

This block recognizes all the sprites on the stage. Click to select a sprite from the drop-down list box
For how to add a sprite, see Add a Sprite.

Click to select a sensitivity from the drop-down list box.
A higher sensitivity indicates that the sprite responds more quickly to the motion of CyberPi.

Example

CyberPi (device) - 图114

In Live mode, when you press the space key, the plane on the stage moves as you move CyberPi.
CyberPi (device) - 图115


44. [tilt]?

CyberPi (device) - 图116

Determines whether CyberPi is placed in the specified posture

How to use

Click to select a posture from the drop-down list box.
The following figure shows the postures defined for CyberPi.

CyberPi (device) - 图117

This is a Boolean block that contains a condition. Use it in combination with another block that requires a condition.

Example

CyberPi (device) - 图118

In Live mode, after you press the space key, the LEDs on CyberPi are lit up when you tilt CyberPi forward and turned off when you place it in another posture.


45. [tilt]detected?

CyberPi (device) - 图119

Determines whether CyberPi is the specified motion state

How to use

Click to select a motion state from the drop-down list box.
The following figure shows the motion states defined for CyberPi.

CyberPi (device) - 图120

This is a Boolean block that contains a condition. Use it in combination with another block that requires a condition.

Example

CyberPi (device) - 图121

In Live mode, after you press the space key, CyberPi displays Up on its screen when you wave it up and clears the screen when you stop waving it up.


46. shaking strength

CyberPi (device) - 图122

Reports how strong CyberPi is shaken

How to use

The shaking strength is positively related to the shaking frequency and amplitude.

Value range: 0–100

You can select the check box on the left of this block to see the shaking strength on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图123

Use this block in combination with Display blocks.
In Live mode, after you press the space key, CyberPi displays the shaking strength in the center of its screen when you shake it and clears the screen when you stop shaking it.


47. waving direction (°)

CyberPi (device) - 图124

Reports the direction in which CyberPi is waved

How to use

The waving direction is defined by angle, as shown in the following figure.

CyberPi (device) - 图125

Value range: –179 to +180, in degrees (°)

You can select the check box on the left of this block to see the waving direction on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图126

Use this block in combination with Display blocks.
In Live mode, after you press the space key, CyberPi displays the waving direction in the center of its screen when you wave it up and clears the screen when you stop waving it.


48. waving speed

CyberPi (device) - 图127

Reports the speed at which CyberPi is waved

How to use

Value range: 0–100

You can select the check box on the left of this block to see the waving speed on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图128

Use this block in combination with Display blocks.
In Live mode, after you press the space key, CyberPi displays the waving speed in the center of its screen when you wave it up and clears the screen when you stop waving it.


49. [rotation]angle (°)

CyberPi (device) - 图129

Reports the angle of the specified posture

How to use

Click to select a posture from the drop-down list box.

The pitch, roll, and yaw angles are defined as follows.

CyberPi (device) - 图130

Value ranges:
Pitch angle: –90 to +90, in degrees
Roll angle: –180 to +180, in degrees
Yaw angle: –180 to +180, in degrees

You can select the check box on the left of this block to see the angle of the posture on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图131

Use this block in combination with Display blocks.
In Live mode, after you press the space key, CyberPi displays the posture angle in the center of its screen when you tilts it backward and clears the screen when you stop tilting it.


50. motion sensor[axis]acceleration(m/s²)

CyberPi (device) - 图132

Reports the acceleration of CyberPi on the specified axis

How to use

Click to select an axis from the drop-down list box.

CyberPi is equipped with a motion sensor that can detects the acceleration of CyberPi on the x-, y-, and z-axis.
Note that the accelerometer measures Earth’s gravity. When CyberPi is placed on a desk, the output of the accelerometer on the z-axis is –9.8m/s² (1g = 9.8m/s²).

The axes are defined as follows.

CyberPi (device) - 图133

You can select the check box on the left of this block to see the acceleration on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图134

Use this block in combination with Display blocks.
In Live mode, after you press the space key, CyberPi displays the acceleration on the z-aixs in the center of its screen when it falls down and clears the screen when you hold it.
Note: When CyberPi falls down, let it land on a soft surface or catch it with your hand to prevent damage to CyberPi.


51. angle speed around [axis]axis(°/s)

CyberPi (device) - 图135

Reports the angular speed at which CyberPi is rotated around the specified axis

How to use

Click to select an axis from the drop-down list box.

The axes are defined as follows.

CyberPi (device) - 图136

Value range: –500 to +500, in degrees/second ()

You can select the check box on the left of this block to see the angular speed on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图137

Use this block in combination with a Display block.
In Live mode, after you press the space key, CyberPi displays the angular speed of CyberPi around the x-axis in the center of its screen when you rotates it around the x-axis.


52. rotated angle around [axis]axis (°)

CyberPi (device) - 图138

Reports the angle CyberPi is rotated around the specified axis

How to use

Click to select an axis from the drop-down list box.

The axes and angles are defined as follows.

CyberPi (device) - 图139

You can select the check box on the left of this block to see the angle on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图140

Use this block in combination with a Display block.
In Live mode, after you press the space key, CyberPi displays the angle in the center of its screen when you rotates it around the x-axis.


53. reset rotated angle around[axis]axis

CyberPi (device) - 图141

Resets the angle CyberPi is rotated around the specified axis (axes) to zero

How to use

Click to select all the axes or an axis from the drop-down list box.

The axes are defined as follows.

CyberPi (device) - 图142

After this block is executed, the angle CyberPi is rotated around the specified axis is counted from zero.

Example

CyberPi (device) - 图143

Use this block in combination with a Display block.
In Live mode, after you press the space key, CyberPi displays the angle in the center of its screen when you rotates it around the x-axis. When the angle is greater than 720, it is reset to zero and counted again.


54. reset yaw angle

CyberPi (device) - 图144

Resets the yaw angle of CyberPi to zero

How to use

The yaw angle is defined as follows.

CyberPi (device) - 图145

After this block is executed, the yaw angle of CyberPi is counted from zero.

Example

CyberPi (device) - 图146

Use this block in combination with a Display block.
In Live mode, after you press the space key, CyberPi displays the yaw angle in the center of its screen when you rotates it around the z-axis. When the angle is greater than 179, it is reset to zero and counted again.


55. joystick[fieldMenu_1]?

CyberPi (device) - 图147

Determines whether the joystick is moved in the specified direction

How to use

CyberPi is equipped with a joystick that can be moved in five directions.

CyberPi (device) - 图148

Click to select a direction from the drop-down list box.
This is a Boolean block that contains a condition. Use it in combination with another block that requires a condition.

Example

CyberPi (device) - 图149

In Live mode, after pressing the space key, you can move the joystick to display “makeblock” in different positions.


56. joystick [fieldMenu_1]counts

CyberPi (device) - 图150

Reports the number of times the joystick is moved in the specified direction

How to use

CyberPi is equipped with a joystick that can be moved in five directions.

CyberPi (device) - 图151

Click to select a direction from the drop-down list box.

You can select the check box on the left of this block to see the number of times on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图152

With this program, CyberPi can be used as a counter.
In Live mode, after pressing the space key, repeatedly move the joystick upward. CyberPi counts from zero and displays the number of times in the center of its screen.


57. reset joystick [fieldMenu_1]counts

CyberPi (device) - 图153

Resets the number of times the joystick is moved in the specified direction to zero

How to use

CyberPi is equipped with a joystick that can be moved in five directions.

CyberPi (device) - 图154

Click to select a direction from the drop-down list box.

After this block is executed, the number of times the joystick is moved in the specified direction is counted from zero.

Example

CyberPi (device) - 图155

With this program, CyberPi can function as a counter.
In Live mode, after pressing the space key, repeatedly move the joystick upward. CyberPi counts from zero and displays the number of times in the center of its screen.


58. button[fieldMenu_1]pressed?

CyberPi (device) - 图156

Determines whether specified button is pressed

How to use

CyberPi is equipped with two buttons, A and B.

CyberPi (device) - 图157

Click to select a button from the drop-down list box.

This is a Boolean block that contains a condition. Use it in combination with another block that requires a condition.

Example

CyberPi (device) - 图158

With this program, CyberPi can function as a recorder.
In Live mode, after pressing the space key, press A and B to start and stop recording.


59. button[fieldMenu_1]press counts

CyberPi (device) - 图159

Reports the number of times the specified button is pressed

How to use

CyberPi is equipped with two buttons, A and B.

CyberPi (device) - 图160

Click to select a button from the drop-down list box.

You can select the check box on the left of this block to see the number of times on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图161

With this program, CyberPi can be used as a counter.
In Live mode, after pressing the space key, repeatedly press button A. CyberPi counts from zero and displays the number of times in the center of its screen.


60. reset button[fieldMenu_1]press counts

CyberPi (device) - 图162

Resets the number of times the specified button is pressed to zero

How to use

CyberPi is equipped with two buttons, A and B.

CyberPi (device) - 图163

Click to select a button from the drop-down list box.

After this block is executed, the number of times the specified button is pressed is counted from zero.

Example

CyberPi (device) - 图164

With this program, CyberPi can be used as a counter.
In Live mode, after pressing the space key, repeatedly press button A. CyberPi counts from zero and displays the number of times in the center of its screen.


61. loudness

CyberPi (device) - 图165

Reports the ambient loudness detected by the microphone on CyberPi

How to use

Value range: 0–100

You can select the check box on the left of this block to see the ambient loudness on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图166

Use this block in combination with a Display block.
In Live mode, when you press the space key, CyberPi displays the ambient loudness detected by the microphone in the center of its screen.


62. ambient light intensity

CyberPi (device) - 图167

Reports the ambient light intensity detected by the light sensor on CyberPi

How to use

Value range: 0–100

You can select the check box on the left of this block to see the ambient light intensity on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图168

Use this block in combination with a Display block.
In Live mode, when you press the space key, CyberPi displays the ambient loudness detected by the microphone in the center of its screen.


63. timer(s)

CyberPi (device) - 图169

Reports the count value of the timer

How to Use

The timer starts to count from 0 each time CyberPi is powered on. This block reports the duration CyberPi runs this time.

You can select the check box on the left of this block to see the count value of the timer on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图170

With this program, CyberPi can function as a timer.
In Live mode, when you press button A on CyberPi, CyberPi starts to count from 0 and displays the time in the center of its screen. When you press button B, CyberPi stops counting.


64. reset timer

CyberPi (device) - 图171

Resets the timer to Zero

How to Use

The timer of CyberPi starts to count from zero each time CyberPi is powered on.
You can use this block to reset the timer, making it start to count from zero again.

Example

CyberPi (device) - 图172

With this program, CyberPi can function as a timer.
In Live mode, when you press button A on CyberPi, CyberPi starts to count from 0 and displays the time in the center of its screen. When you press button B, CyberPi stops counting.


65. hostname

CyberPi (device) - 图173

Reports the hostname of CyberPi

How to use

The default hostname of CyberPi is cyberpi.

The hostname is displayed on the UI of the CyberOS system that runs on your CyberPi. By setting device names, users can find their CyberPis or identify one another on a LAN or IoT.

You can set the hostname as follows.

CyberPi (device) - 图174

You can select the check box on the left of this block to see the hostname on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图175

Use this block in combination with a Display block.
In Live mode, when you press the space key, CyberPi displays the hostname you set in the center of its screen.


66. [fieldMenu_1]

CyberPi (device) - 图176

Reports information of the hardware device

How to use

With this block, you can obtain the battery level, MAC address, Bluetooth name, system language, and extension board name of CyberPi.

The battery level refers to that of the extension board connected to CyberPi, ranging from 0 to 100. Do not use this option if no extension board is connected.

The MAC address is used to connect to Wi-Fi. Note that the MAC address you obtain by using this block may be wrong if CyberPi is not connected to Wi-Fi. The output value is a 12-byte string.

The Bluetooth name refers to that broadcast by CyberPi, used for Bluetooth connection.

The system language refers to the language currently used on the CyberOS system running on CyberPi.

The extension name refers to the name of the extension board connected to CyberPi (not implemented currently).

You can select the check box on the left of this block to see the corresponding information on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图177

Note: Set the Wi-Fi account and password to those available.
Compile this program in Upload mode and upload it to CyberPi.
Press button A. CyberPi starts to connect to Wi-Fi.
After the LEDs are lit up in green, press button B. CyberPi displays its MAC address on its screen.


67. broadcast message [message] on LAN

CyberPi (device) - 图178

Broadcasts the specified message on the LAN

How to use

Click to set the name of the message to be broadcast.

The message broadcast by CyberPi through this block can be received by all the other devices on the same LAN.

Note:
All CyberPis on the same LAN must use the same channel for communication.
Without router connection, CyberPis use the same default channel and thus can communicate with each other on the LAN; when CyberPi is connected to a router, its channel depends on the setting of the router, which may be different from the default channel, and thus it may fail to communicate with another CyberPi that is not connected to the router.
Therefore, to ensure proper communication, if you use a router, connect all CyberPis on the same LAN to the router.

Example

The following programs enable two CyberPis to interact with each other.

CyberPi 1
download.png

CyberPi 2
image.png
Compile the two programs in Upload mode and upload them to CyberPis 1 and 2, respectively.
Restart CyberPis 1 and 2.
Press button A on CyberPi 1. CyberPi 2 says “hi.”


68. broadcast message[message]with value[value]on LAN

CyberPi (device) - 图181

Broadcasts the specified message with the specified value on the LAN

How to use

Click to set the name of the message and the value to be broadcast.

The message broadcast by CyberPi through this block can be received by all the other devices on the same LAN.

Note:
To ensure proper communication, if you use a router, connect all CyberPis on the same LAN to the router.

Example

The following programs enable two CyberPis to interact with each other.

CyberPi 1
download (1).png

CyberPi 2
download (2).png

Compile the two programs in Upload mode and upload them to CyberPis 1 and 2, respectively.
Restart CyberPis 1 and 2.
Press button A on CyberPi 1.
CyberPi 2 displays the value 1 on its screen.


69. when receiving[message]boadcast on LAN

CyberPi (device) - 图184

Executes the subsequent block(s) when the specified message is received

How to use

CyberPi can receive messages broadcast by other devices on the same LAN.

Note:
To ensure proper communication, if you use a router, connect all CyberPis on the same LAN to the router.

Example

The following programs enable two CyberPis to interact with each other.

CyberPi 1
download (3).png

CyberPi 2
download (4).png

Compile the two programs in Upload mode and upload them to CyberPis 1 and 2, respectively.
Restart CyberPis 1 and 2.
Press button A on CyberPi 1. CyberPi 2 says “hi.”


70. LAN broadcast [message]value received

CyberPi (device) - 图187

Reports the value received by CyberPi through the specified message

How to use

After being connected to Wi-Fi, CyberPi can receive messages and values broadcast by other devices connected to the same Wi-Fi.

You can select the check box on the left of this block to see the received value on the stage.

This is a reporter block that must be used in combination with another block requiring data.

Note:
To ensure proper communication, if you use a router, connect all CyberPis on the same LAN to the router.

Example

The following programs enable two CyberPis to interact with each other.

CyberPi 1
image.png
CyberPi 2
image.png
Compile the two programs in Upload mode and upload them to CyberPis 1 and 2, respectively.
Restart CyberPis 1 and 2.
Press button A on CyberPi 1.
CyberPi 2 displays the value 1 on its screen.


71. connect to Wi-Fi[ssid] password [wifipassword]

CyberPi (device) - 图190

Connects CyberPi to the specified Wi-Fi

How to use

CyberPi is equipped with a module that supports the following functions:

  • AI functions: enables CyberPi to recognize speeches and translate texts
  • IoT functions: facilitates cross-network and cross-device interaction and control

Click to set the Wi-Fi account and password that are available.

Example

CyberPi (device) - 图191

Compile this program in Upload mode and upload it to CyberPi.
Press button A. CyberPi starts to connect to the specified Wi-Fi.
When the LEDs are lit up in green, the connection is successful.


72. network connected?

CyberPi (device) - 图192

Determines whether CyberPi has connected to Wi-Fi

How to use

This is a Boolean block that contains a condition. Use it in combination with another block that requires a condition.

Example

CyberPi (device) - 图193

Compile this program in Upload mode and upload it to CyberPi.
Press button A. CyberPi starts to connect to the specified Wi-Fi.
When the LEDs are lit up in green, the connection is successful.


73. speak[fieldMenu_1][string_2]

speak.png

Recognizes the specified text and reads it out loud in the recognized language

How to use

Click to enter the text to be recognized.

Example

CyberPi (device) - 图195

Note: Set the Wi-Fi account and password to those available.
Compile this program in Upload mode and upload it to CyberPi.
Press button A. CyberPi starts to connect to Wi-Fi.
After the LEDs are lit up in green, press button B. CyberPi says “Hello world.”


74. recognize[fieldMenu_1] [number_2]secs

recognize.png

Recognizes the specified language for the specified period

How to use

Click to select a language fron the drop-down list box and set the time.

Example

CyberPi (device) - 图197

Note: Set the Wi-Fi account and password to those available.
Compile this program in Upload mode and upload it to CyberPi.
Press button A. CyberPi starts to connect to Wi-Fi.
After the LEDs are lit up in green, press button B and speak in English. CyberPi displays the words recognized on its screen.


75. speech recognition result

CyberPi (device) - 图198

Reports the words recognized in a speech

How to use

This is a reporter block that must be used in combination with another block requiring data.

Example

CyberPi (device) - 图199

Note: Set the Wi-Fi account and password to those available.
Compile this program in Upload mode and upload it to CyberPi.
Press button A. CyberPi starts to connect to Wi-Fi.
After the LEDs are lit up in green, press button B and speak in English. CyberPi displays the words recognized on its screen.


76. translate[string_1] into[fieldMenu_2]

translate.png

Reports the translation of the specified text

How to use

Click to the enter the text to be translated and the target language.
Currently, this block supports only Chinese-English and English-Chinese translation.

Example

CyberPi (device) - 图201

Note: Set the Wi-Fi account and password to those available.
Compile this program in Upload mode and upload it to CyberPi.
Press button A. CyberPi starts to connect to Wi-Fi.
After the LEDs are lit up in green, press button B. CyberPi says “你好.”


77. send user cloud broadcast[message]

CyberPi (device) - 图202

Sends the specified user cloud message

How to use

What is a user cloud message?

With the same mBlock 5 account, user cloud messages enable cross-device and cross-project communication, that is, you can enable CyberPi to interact with other CyberPis and sprites after signing in with the same mBlock 5 account.

Before using the user cloud message function, you need to:

  1. Set mBlock 5 to the Upload mode
  2. Sign in to your mBlock 5 account
  3. Connect CyberPi to Wi-Fi

Click to set the name of the user cloud message to be sent.

Example

The following programs enable CyberPi to interact with a sprite.

CyberPi

CyberPi (device) - 图203

Sprite

CyberPi (device) - 图204

Note: Set the Wi-Fi account and password to those available.
Compile the two programs in Upload mode and upload the program to CyberPi.
Press button A. CyberPi starts to connect to Wi-Fi.
After the LEDs on CyberPi are lit up in green, press button B. CyberPi sends the user cloud message named message.
After receiving the user cloud message, the sprite moves 10 steps.


78. send user cloud broadcast [message]with value [value]

CyberPi (device) - 图205

Sends the specified user cloud message and the specified value

How to use

Click to set the name of the user cloud message and the value to be sent.

Example

The following programs enable CyberPi to interact with another CyberPi.

CyberPi 1

CyberPi (device) - 图206

CyberPi 2

CyberPi (device) - 图207

Note: Set the Wi-Fi account and password to those available.
Compile the two programs in Upload mode and upload them to CyberPis 1 and 2, respectively.
Press button A on CyberPis 1 and 2. They start to connect to Wi-Fi.
After the LEDs on CyberPi are lit up in green, press button B on CyberPi 1. CyberPi 1 sends the user cloud message named message and the value 1.
After receiving the user cloud message, CyberPi 2 displays the value 1 on its screen.


79. when receiving user cloud broadcast[message]

CyberPi (device) - 图208

Executes the subsequent block(s) when the specified user cloud message is received

How to use

After being connected to Wi-Fi, CyberPi can interact with a sprite or another CyberPi that is programmed with the same mBlock 5 account.

Example

The following programs enable CyberPi to interact with a sprite.

CyberPi

CyberPi (device) - 图209

Sprite

CyberPi (device) - 图210

Note: Set the Wi-Fi account and password to those available.
Compile the two programs in Upload mode and upload the program to CyberPi.
Press button A. CyberPi starts to connect to Wi-Fi.
After the LEDs on CyberPi are lit up in green, press button B. CyberPi sends the user cloud message named message.
After receiving the user cloud message, the sprite moves 10 steps.


80. user cloud broadcast[message]value received

CyberPi (device) - 图211

Reports the value received through the specified user cloud message

How to use

After being connected to Wi-Fi, CyberPi can interact with a sprite or another CyberPi that is programmed with the same mBlock 5 account.

This is a reporter block that must be used in combination with another block requiring data.

Example

The following programs enable CyberPi to interact with another CyberPi.

CyberPi 1

CyberPi (device) - 图212

CyberPi 2

CyberPi (device) - 图213

Note: Set the Wi-Fi account and password to those available.
Compile the two programs in Upload mode and upload them to CyberPis 1 and 2, respectively.
Press button A on CyberPis 1 and 2. They start to connect to Wi-Fi.
After the LEDs on CyberPi are lit up in green, press button B on CyberPi 1. CyberPi 1 sends the user cloud message named message and the value 1.
After receiving the user cloud message, CyberPi 2 displays the value 1 on its screen.


81. [LOCATION] [WEATHER_TYPE]

CyberPi (device) - 图214

Reports the specified weather condition of the specified district

How to use

Click to set the district and the weather condition you want to know about.

Example

CyberPi (device) - 图215

Note: Set the Wi-Fi account and password to those available.
Compile the program in Upload mode and upload it to CyberPi.
After the LEDs on CyberPi are lit up in green, press button A. CyberPi displays the highest temperature in Shenzhen on its screen.


82. air quality[METEOROLOGICAL] [aq_type]

CyberPi (device) - 图216

Reports the specified weather quality condition of the specified district

How to use

Click to set the district and the weather quality condition you want to know about.
download (5).png

Example

download (6).png
Note: Set the Wi-Fi account and password to those available.
Compile the program in Upload mode and upload it to CyberPi.
After the LEDs on CyberPi are lit up in green, press button A. CyberPi displays the air quality index (AQI) today in Shenzhen on its screen.


83. [LOCATION] [sun_move_type] [time_type]

CyberPi (device) - 图219

Reports the sunrise or sunset time of the specified district

How to use

Click to set the district and the sunrise or sunset time you want to know about.

Example

download (7).png
Note: Set the Wi-Fi account and password to those available.
Compile the program in Upload mode and upload it to CyberPi.
After the LEDs on CyberPi are lit up in green, press button A. CyberPi displays the sunrise time today in Shenzhen on its screen.


84. get [fieldMenu_1]’s [fieldMenu_2]

CyberPi (device) - 图221

Reports the specified time information of the specified time zone (UTC)

How to use

Click to select a time zone and time item from the drop-down list boxes.

Example

image.png

Note: Set the Wi-Fi account and password to those available.
Compile the program in Upload mode and upload it to CyberPi.
After the LEDs on CyberPi are lit up in green, press button A. CyberPi displays the year of the time zone UTC 0 on its screen.


85. [ICON]when CyberPi starts up

CyberPi (device) - 图223

Executes the subsequent block(s) when CyberPi starts

How to use

This is a hat block that is always placed on top of other blocks to activate them.

Example

download (8).png
Note: Set the Wi-Fi account and password to those available.
Compile the program in Upload mode and upload it to CyberPi.
CyberPi automatically connects to the Wi-Fi and light up the LEDs in green when the connection is complete.


86. [image_1]when joystick [fieldMenu_2]

CyberPi (device) - 图225

Executes the subsequent block(s) when the joystick is moved in the specified direction

How to use

This is a hat block that is always placed on top of other blocks to activate them.
Click to select a direction from the drop-down list box.

Example

download (9).png
In Live mode, each time when you move the joystick up, the number displayed on CyberPi’s screen increases by one.


87. [image_1]when button[fieldMenu_2]pressed

CyberPi (device) - 图227

Executes the subsequent block(s) when the specified button is pressed

How to use

This is a hat block that is always placed on top of other blocks to activate them.
Click to select a button from the drop-down list box.

Example

download (10).png
In Live mode, each time when you press button A, the number displayed on CyberPi’s screen increases by one.


88. [image_1]when CyberPi[tilt]

CyberPi (device) - 图229

Executes the subsequent block(s) when CyberPi is placed in the specified posture

How to use

This is a hat block that is always placed on top of other blocks to activate them.
Click to select a posture from the drop-down list box.

Example

download (11).png
In Live mode, when you tilt CyberPi to the left, it shows the angle it is tilted on its screen.


89. [image_1]when[tilt]detected

CyberPi (device) - 图231

Executes the subsequent block(s) when you perform the specified action on CyberPi

How to use

This is a hat block that is always placed on top of other blocks to activate them.
Click to select an action from the drop-down list box.

Example

download (12).png
In Live mode, when you rotate CyberPi clockwise, it shows the angle it is rotated on its screen.


90. [image_1]when[fieldMenu_2]value [fieldMenu_3][number_3]

CyberPi (device) - 图233

Executes the subsequent block(s) when the output value is greater or smaller than the specified value

How to use

This is a hat block that is always placed on top of other blocks to activate them.

CyberPi is equipped with multiple sensors, which allow it to detect light intensity, loudness, how strong it is shaken, and how long it has been running.

Click to select an output value from the drop-down list box.

Example

download (13).png
In Live mode, when you shade CyberPi or put it in a dark place, the LEDs are lit up in white; and when you illuminate the place where it is, the LEDs go off.


91. [image_1]restart CyberPi

CyberPi (device) - 图235

Restarts CyberPi

Example

download (14).png
CyberPi restarts when the duration it runs exceeds 3600 seconds.


92. insert code [string_1]

CyberPi (device) - 图237

Executes the specified Python code

How to use

You can enter Python code in the text box to execute it.
For Python code that can be used, see Python API Documentation for CyberPi.
Note: This block can be used only in Upload mode. Enter MicroPython code when using this block.

Example

image.png
After you upload the program to CyberPi, the screen displays hello world in the direction of left (0°) when you press button A.


93. read[string_2] in[fieldMenu_1]

CyberPi (device) - 图239

Reports the specified information in the specified data type

How to use

Click to select a data type from the drop-down list box and insert the reporter block that reports the information you want into this block.
Note: Select the data type that is applicable to the information to be reported. For example, the hostname is of the string type. If you select the integer type to obtain the hostname, no information is reported.

Example

image.png
In Live mode, when you press the space key, two pieces of data are displayed on the screen. One is an integer, and the other is a floating-point number.