Block Programming
The building block programming page integrates block-based drag-and-drop programming and quick access to core functions, covering the entire process of program editing, generation and invocation of waypoints and trajectories, running and debugging, joint control, and file management. It provides a one-stop solution for development and debugging needs.
You can click the Block Programming icon, or click the Create File button to enter the Block Programming page.
Of course, you can also click the
Open Filebutton, which will automatically navigate to the Block Programming page and load the content of the file you have saved, including the workspace, waypoints, and trajectory files (for how to save the workspace, please click here)Clicking the Block Programming icon or the Create File button to enter the Block Programming page is equivalent to creating a new workspace.

The Block Programming page is shown as follows:

1 Interface Introduction

| Serial Number | Function Description |
|---|---|
| 1 | Save: Save the block program file. By default, files are saved to File Management - Test File Space; |
| 2 | Save As: Save the file to a local computer directory outside File Management - Test File Space; |
| 3 | File Management: Open the file list panel to edit, delete, and perform other operations on block program files; |
| 4 | Waypoints & Trajectory: Quickly create teaching points and run them, and record trajectories for playback; |
| 5 | One-step execution: Select a block and click this button to execute only the currently selected block; |
| 6 | Run Panel: Open the run panel to run and debug the workspace code; |
| 7 | Quick Move: Quickly control the movement of the robotic arm; |
| 8 | Freemove: Enable or disable free movement mode; |
| 9 | Toolbox: Provides ready-made blocks for users; |
| 10 | Workspace: Drag blocks from the toolbox here for programming; |
| 11 | Posture: Open the posture page to view the real-time simulated motion posture of the 3D model; |
| 12 | Workspace Calibration: After clicking, the workspace returns to the origin; |
| 13 | Zoom In: Zoom in on the workspace; |
| 14 | Zoom Out: Zoom out on the workspace; |
| 15 | Trash Can: Drag workspace blocks here to delete them; deleted blocks can also be retrieved from here; |
2 Block Programming Workbench
The following is a brief introduction to the Block Programming workbench, including the block repository and programming area, where you can perform block programming
The function description of each building block can be found in the Building Block Introduction Section
The workbench is a visual programming area, including the toolbox, workspace, calibration, zoom in, zoom out, and trash can functions.
2.1 Toolbox
The software provides a pre-set interface of building blocks, which can be selected by clicking with the left mouse button. Then, drag it to the programming area by holding down the mouse button. Visual programming can be achieved by stacking the building blocks up and down, thereby reducing the difficulty of programming.
2.2 Workspace
You can think of it as a common storage area where any existing building blocks will be transformed into executable code and applied to the robotic arm in a specific way. When programming with building blocks, it is recommended that you follow the "assembly" rules to avoid confusion in execution. Select the building blocks you want to operate on and click the right mouse button at the same time. This will display the building block operation menu, including operations such as copying, deleting, and disabling.
2.3 Calibration
Adjust the size of the programming perspective and restore the programming area perspective to its default state.
2.4 Zoom in
Adjust the size of the programming perspective and enlarge the perspective of the programming area.
2.4 Zoom out
Adjust the size of the programming perspective and reduce the size of the programming area perspective.
2.5 Trash can
After deleting the building blocks, if you want to reuse them, you can click the Trash Can icon at the bottom right of the workbench. After clicking, the deleted code in this programming area will be displayed. If you want to continue using them, simply drag them back into the programming area.
Next, a simple arithmetic example is used to help you get familiar with the functions introduced above.
First, click Basic Programming in the left toolbar, then click the Math category to display the available blocks in that category.

Then drag both blocks to the programming area and assemble them. Note: Some blocks have parameter slots and can be assembled by combining blocks with matching connectors.

After assembly, to see the programming result, you still need to run the block code. Click Run Panel in the upper-right corner of the workbench. After the run panel opens, click the Run All button to run the code.
You can observe that the blocks are converted into actual running code and displayed in the log panel. To better understand the run logs, it is recommended that you learn basic Python syntax.

Blocks with output values usually have a protruding connector at the front or end and can be assembled with blocks that have a matching recessed connector. Blocks without output values are closed at both ends.
If you want to know the execution result of certain blocks, you also need to use an output block. Taking the example above, select the Text category, drag out the Print block, and assemble it with the code whose output you want to see.

Then run the programming area code again and check the log panel. You can observe that the run result is also displayed.

If you want to program the same blocks again, you can use the Duplicate function. First select the block, then right-click to show the operation menu and choose Copy, or use Ctrl + C and Ctrl + V on the keyboard.

After clicking Duplicate, the block will be copied.

If you want to delete a block, you can use the Delete function. First select the block, then right-click to show the operation menu and choose Delete, or use Backspace or Delete on the keyboard.

Deleted blocks all go into the trash can. Drag them back to the programming area when you need them again.

If you want a certain building block to exist in the programming area but want the actual running logic of that block to be skipped during runtime, you can use the Disable function. The building block menu offers the Disable and Enable options. Select the building block you want to operate on by right-clicking with your mouse.

The disabled block styles will display a pattern similar to a cross grid. Similarly, the disabled blocks can also be enabled.

Through this simple block programming introduction, you have roughly mastered the workbench functions. To write more complex code, you will need more time to explore!
3 File Management
The following introduces the file management function, which centrally manages all block programming files. Files can be published to the robotic arm and played on the minirobot screen so they can be used without a computer
Function description: Through the file management module, you can conveniently save, import, and export files under different file spaces. There are two ways to open the file list: Homepage - Open File, or the file operation menu on the myBlockly page - Open. This opens the file management list and loads your saved file content, including the workspace, waypoints, and trajectory files (for how to save the workspace, please click here).

| Number | Description |
|---|---|
| 1 | Draft file space: Switching to this option paginates and queries all test files. The Draft files are stored on the local computer device. |
| 2 | Runner file space: Switching to this option paginates and queries all production files.The storage space of BlocklyRunner in the small-screen SD card can be used to publish files that can be played offline on the MiniRobot device. |
| 3 | Recycle bin file space: Switching to this option paginates and queries all recycle bin files (files deleted from the test/production spaces go to the recycle bin). |
| 4 | Search condition input box: Currently only fuzzy search by file name is supported. Press Enter to search, or click button 5. |
| 5 | Search button: Click to perform a paginated search based on the input box content. |
| 6 | Import button: Click to import files from the current device. |
| 7 | Export button: Disabled by default; enabled when a file is selected. Click to export the selected file. |
| 8 | List data selection column: Prerequisite for functions 7 and 11-14. |
| 9 | Single-file operation buttons, including: Edit - load file content into the workspace; Preview - for trajectory files only; the 3D model simulates trajectory points. |
| 10 | Pagination button: Enables pagination when the current space exceeds the specified quantity. |
| 11 | Delete button: Delete - delete selected files to the recycle bin. |
| 12 | Debug button: Select one file and click to load the file content into the workspace and automatically open the debug panel. |
| 13 | Run button: Select one file and click to load the file content into the workspace and automatically open the run panel, where you can set the file run loop count - infinite loop or a specified number of loops. |
| 14 | Publish button: Select one or more files and click to publish the files to the production space. |
Search
By default, all files are queried. You can enter a file name for a fuzzy search. When the input box has content, the search is based on the current file space and the content. A successful search will display a message.

Import
Note: The file selected for import must be a file exported from myStudio Pro; otherwise, you may see
Import failed/ import succeeds butcannot be edited.
Click the Import button, select the file to import, and click OK. Batch import is supported. On Windows, press Shift/Ctrl to multi-select files to import.


Edit
Click the Edit button to load the file content into the workspace.


Preview
Click the Preview button to open the preview panel. The 3D model will simulate motion based on the actual points in the trajectory file.


Delete
Click the Delete button for batch deletion. Selected files are moved to the recycle bin. If the delete files is performed on recycle bin files, they are permanently deleted and cannot be recovered.
Select the files to delete, then click the Delete button. Switch to the Recycle Bin option to query the deleted files in the list.



Recover
Select the files to recover, then click the Recover button to restore recycle bin files to the test space.



Debug
Select the file to debug, then click the Debug button. The system first checks whether the workspace has unsaved content and prompts you if so. Click Confirm to load into the workspace; otherwise it loads directly and opens the debug panel.



Run
Select the file to run, then click the Run button. The system first checks whether the workspace has unsaved content and prompts you if so. Click Confirm to load into the workspace; otherwise it loads directly, opens the run panel, and you can click Run to execute.

You can choose infinite run or a specified number of runs (the following explains count loops). After setting, loop running can start. A secondary run confirmation appears first; click Confirm to start loop running.

After running is completed.

Publish
Select the files to publish, then click the Publish button to publish the corresponding files from the test space to the production space. Batch publishing is supported.

After the release is successful, the file will be synchronously updated to the BlocklyRunner folder on the small screen, and can be viewed and played immediately on the small screen.

Copy
Click the Copy button to copy production space files to the test space. Batch copying is supported.

4 Waypoints
The following introduces the waypoint function, used to record multiple waypoint data entries (joints + coordinates) so the robotic arm automatically reaches each preset position in sequence
Function description: By recording multiple waypoint data entries (robotic arm joints and coordinates), you can quickly control the robotic arm to reach each waypoint position. Open the waypoint list page, enable free movement, then long press the white vermilion button at the end, relax the robotic arm, manually adjust the posture of the robotic arm, and click "Add New Point" to add a route point data.

| Number | Function Description |
|---|---|
| 1 | Import button:import a previously saved waypoint information JSON file. |
| 2 | Save button:export all waypoint information into a single JSON file. |
| 3 | Delete button:delete all currently selected waypoints in the list. |
| 4 | Copy button:copy the coordinate information of all currently selected waypoints. |
| 5 | Rename button:rename all currently selected waypoints. |
| 6 | Overwrite Current Point button:quickly overwrite the coordinate information of all selected waypoints with the current robotic arm coordinates. |
| 7 | List data selection column: Prerequisite for functions 3-6. |
| 8 | Run button:to move the robotic arm to the currently recorded waypoint position. |
| 9 | Add Point button:to record the current robotic arm coordinate information. |
| 10 | Generate Code button:to quickly generate waypoint blocks into the Blockly program coding area. |
In Block Programming, select the waypoint block and add it to the program coding area. Alternatively, use the Generate Code button in the waypoint list to append the generated waypoint block after the last block in the workspace.

The waypoint block is associated with data in the waypoint list. Select any waypoint in the list to associate it.


Add point information to the waypoint block. Select Add Point, click the edit icon to open the add-waypoint dialog. A custom waypoint name is provided by default. Adjust the waypoint information with + or -, then click Save Waypoint to add the waypoint data.

In addition, the waypoint block can change the motion mode. Joint motion mode: move using the joint information of the current waypoint. Linear motion mode: move using the coordinate information of the current waypoint.
| Number | Description |
|---|---|
| 1 | Select a waypoint:Clicking the edit icon opens the waypoint editing dialog. |
| 2 | name input box: Enter the waypoint name. |
| 3 | Joint/Coordinate Control Area:Displays the joint and coordinate data of the robotic arm. Adjust the waypoint data with the left (-) and right (+) buttons. |
| 4 | Save button:Click Save Waypoint to add or modify waypoint data. |
5 Trajectory
The following introduces the trajectory function: manually drag the robotic arm to record a motion trajectory, then select and play it back
Function description: By recording trajectory data (robotic arm joints), you can quickly control the robotic arm to reach each trajectory point. Open the trajectory list page, click Record Trajectory, the joints of the robotic arm will relax, press the end-effector button and manually drag the robotic arm to record the trajectory, click Stop Recording and wait for the trajectory to be saved. Once saved, trajectory recording is complete. (For file-related operations, please click here).

| Number | Description |
|---|---|
| 1 | Delete button:First select the trajectories to delete. At least one item must be checked for the button to be available. Click Delete to delete all checked trajectories. |
| 2 | List data selection column: Prerequisite for function 1. |
| 3 | Repetition button:play back the trajectory. |
| 4 | Save button:copy the current trajectory to the test file workspace. |
| 5 | Record Trajectory button:The robotic arm will ask for secondary confirmation before recording. After confirmation, recording starts (maximum 120s; recording stops automatically when exceeded). |
Click the Waypoint & Trajectory button to open the function panel. Switch to the trajectory list section. Click the Record Trajectory button at the bottom right of the panel. A confirmation pop-up window for enabling the free movement mode will appear.

Click the Confirm button, and the robotic arm will automatically relax and enter the trajectory recording stage. At this time, you can freely drag the robotic arm to record the trajectory. The button at the bottom right of the panel will change to Stop recording and the duration of this recording will be updated in real time.

When the Stop recording button is clicked when no more trajectory is being recorded, the recording stops and the robotic arm is properly locked. The trajectory recording is completed (the maximum recording time is 120 seconds; it will automatically stop after the time limit is reached).

After recording, the trajectory list will add the corresponding trajectory data. You can replay the recorded trajectory by clicking the Repetition button. When you click the Repetition button, the robotic arm will start the trajectory replay, and a message indicating the start will be displayed on the page.

When the trajectory reproduction is completed, the robotic arm stops moving and the page will display a message indicating the end.

Note: The trajectory list only stores one trajectory data. The newly recorded trajectory will overwrite the previous data. You can save this trajectory to the file management list for easy reuse of the recorded trajectories. Just click the Save button.

In Block Programming, select the trajectory block and add it to the program programming area. The trajectory data in the drop-down menu of the building blocks is derived from the current trajectory list. It is not possible to manually input the trajectory path.

In the workspace, click the drop-down menu of the trajectory block to select data from the current trajectory list page.

After selection, open the Run Panel and click Run All to play back the trajectory via block execution.

After the program finishes, trajectory playback is complete. You can also combine other blocks for more complex programming.
6 Run Program
The following introduces the run program function. You can run a single block via one-step execution, or run all blocks in the workbench via the run panel
One-step execution means: execute a single block. When there are many blocks in the workspace and you only want to execute one of them to see the effect, you can use one-step execution.
The One-step button is initially in an disabled state and cannot be clicked. This function can only be used when a single building block has been selected.
Step 1: Drag several Set Joint blocks into the workspace.

Step 2: Select the Set Joint block. You will observe that the One-step button has been unlocked (its color becomes darker).

Step 3: Click the One-step button. The run panel opens automatically and code execution starts. Observe the robotic arm motion changes. (One-step sets joint 1 to 30°)

This section introduces how to debug block code through the Run Panel, including program Pause, Resume, One-step, and Stop.
Edit a program that controls the motion of robotic arm Joint 1.

Click the Run Panel button. When the run panel appears, click Run All, then immediately click the Pause button. The program will pause after executing the first instruction mc.set_angle(1,0,20).

The program is paused. The next instruction to be executed, time.sleep(3), appears.
At this point:
- If you click the
Resumebutton, the program will continue automatically; - If you click the
One-stepbutton, the program will execute thetime.sleep(3)instruction. ClickOne-stepagain to execute the next instruction, namelymc.set_angle(1,-90,20); - If you click the
Stopbutton, the program will be terminated;
7 Quick Move
The following introduces the Quick Move function, which directly controls movement of each joint or each coordinate axis of the robotic arm
What is Quick Move? Simply put, you can quickly control robot movement with mouse clicks only, without programming.
Step 1: Click the Quick Move button to open the Quick Move panel and wait for robot data to return.


If all data is zero, please check whether the robotic arm is connected and whether it is working normally.
Step 2: Use the - / + buttons to control different joints of the robotic arm. Single click, long-press continuous movement, and direct modification of angles/coordinates followed by Enter are supported.

Step 3: Control coordinates.
First return the robotic arm to the zero position, as shown below. Or long-press the Return to Zero button in the upper-right corner and wait until return-to-zero is completed.

For other functions, please refer to the Debug Panel
8 Free Move
The following introduces the free movement function. After clicking the switch, the motors are released and you can drag the robotic arm to any position by hand
When free movement mode is enabled, the icon is in color; when it is disabled, the icon is gray. Entering the Block Programming page automatically detects the current mode.
Note: When the software starts, free movement mode is set to the disabled state.

Click the inactive free movement button to open a confirmation prompt for enabling free movement mode. Click Confirm to activate it. After activation, you can press the end-effector button to move the robotic arm.


When it is enabled, clicking the button directly issues a disable command. After it is disabled successfully, a corresponding prompt message is displayed, and the button highlight is cleared.

After enabling free movement, if you execute motion instructions through the building blocks or the debugging panel, the white matte button will automatically be disabled. To use free movement again, you need to first turn off the mode and then re-enable it.
9 Gate-Style Pick-and-Place Case
The following introduces the gate-style pick-and-place case. Please ensure that a suction pump tool is installed at the end of the robotic arm
Before reading this section, make sure you have already mastered the waypoint, program running, and file management functions. Also ensure there are no obstacles in the robotic arm workspace so that the arm can move normally.
First, place the object to be picked within the workspace. After the object is placed steadily, record its point information. You can use the Freemove and Waypoint functions.
- Enable
Freemovemode.

- Hold the
white frostedbutton and move the robotic arm to the position directly above the object to be picked. After reaching the position, release the button, open theWaypoints & Trajectorypanel, and clickAdd Pointto record this point data (Point 1).

- After recording the point directly above the object, record the point where the suction pump should pick the object. Likewise, press the
white frostedbutton and move the robotic arm to a position where the suction pump tool can pick the object. After reaching the position, release the button, open theWaypoints & Trajectorypanel, and clickAdd a new pointto record this point data (Point 2-Grab point).This position is mainly for the suction pump to successfully pick the object

- After completing the steps above, it is recommended that you copy Point 2 as a transition point (Point 3).

- Now define a point directly above the object release position. You can adjust the robotic arm to the corresponding point via Freemove or Quick Move. It is recommended to move only Joint 1 for this point. After the move is completed, record this point as well (Point 4).

- After recording Point 4, define the actual object release point. It is recommended to set it directly below Point 4 (Point 5-Placement point).

- Then copy Point 4 as a return-to-zero transition point (Point 6).

- Finally, click the Return to Zero button in the upper-right corner or use blocks to move the robotic arm to the initial position, and record this position (Point 7-Zero point).

After all waypoint information for this case has been recorded, you need to use the suction pump control blocks in the End Tool category and the waypoint blocks in the Movement category. If you are not familiar with the waypoint function, it is recommended that you carefully read the Waypoints introduction first.
Select all waypoint data, then click the Generate Code button in the Waypoints & Trajectory panel to generate the corresponding waypoint blocks.

Taking the operations above as an example, Point 2 is the object pick point. Assemble a suction pump control block with it and set the status to Release. When this code is executed, the suction pump will pick the object.
Likewise, Point 5 is the object release point. Assemble a suction pump control block with it and set the status to Open. When this code is executed, the suction pump will release the object.
Finally, turn off the unused suction pump and return the robotic arm to zero. The complete block programming code is shown below.

Return the robotic arm to zero, then click the Run Panel to see the pick-and-place case effect.
If you need to pick multiple objects, you can add loop control.

Save this case to File Management. Click the Save button, name the file (case1), and click the Confirm button to confirm saving.

After saving successfully, you can manage the file in the File Management panel.

If you want to save the program to the device, you can use the Save As function. Click the button and a file path selection window will pop up. The default file name is "blockly.json", and you can customize the file name.

Select the path to be saved and define the files to be saved. Click the save button to complete the saving process. If you choose "Save As", you can view the saved files in the corresponding path on the device after the saving is successful.

Open the File Management Panel and select this file.Select the file and click the Runner button to publish it to the minirobot. After publishing successfully, the file becomes a production file, and you can find a .py file with the same name under the BlocklyRunner menu item on the minirobot (Note: Blockly-type files published from the software to the minirobot are stored as .py files)

You can then run the corresponding file on the minirobot. For details, see the minirobot BlocklyRunner chapter
10 Drag Teaching Case
The following introduces the drag teaching case
Note: The software has a mutually exclusive function between the main control page and the small screen. It is recommended to exit the building block programming page before recording, and then re-enter after the recording is completed.
The following are the pages that have control over mutual exclusivity:
- Block Programming Page
- Debug Panel Page
- Check Updates Page
- Initial Position Page - Packaged Position
- Test Module Page
First, use the Drag Teaching function on the minirobot to record two teaching trajectories. In this case, they are TPL0004 and TPL0003.
After recording is completed, open the File Management panel and select Runner to query the corresponding trajectory files.

Use the Copy function in File Management to copy the trajectory files generated on the minirobot to Draft Files. Draft Files support Edit and Preview.

Next, we play a trajectory file based on a certain judgment condition. This case combines checking the status of end-effector IO pin 1 (input/output status and high/low level) to play the trajectory file.
First, create a variable a, then click the Confirm button.

After the variable is created, program with blocks using the if-then / else logic blocks. If the if branch condition is met—current pin output is 3 (output low level)—play TPL0004; otherwise execute a++ logic and return the robotic arm to zero.
The specific block code is as follows:

Click the Run Panel to run the code.

Now, if you want the code to execute the else branch, go to the Debug Panel and change pin 1 from output low level to output high level. For details, see the tool pins function in the Debug Panel chapter.
Note: Save the programmed code in advance.

After the modification is completed, return to Block Programming, edit the file, and run the code again.

11 Multiple Material Handling Cases
The following introduces the multi-material handling case. When multiple objects are arranged at equal intervals along joint 1, you only need to set the grasping angle and placement angle of the first object; the remaining points are calculated by the program through accumulation. Please ensure that a suction pump tool is installed on the end of the robotic arm.
This case uses angle motion control to handle the materials. j1 stores the joint 1 angle for grasping the current object, and j1-1 stores the joint 1 angle for placing the current object. After each handling cycle, both variables are increased by 5°, so the robotic arm moves on to the next object.
First, expand Basic, then click Create variable... in the Variables category to create the variables j1 and j1-1.



After the variables are created, use the set ... to block to set j1 to 0 and j1-1 to 60. 0 is the joint 1 grasping angle of the first object, and 60 is the joint 1 placement angle of the first object. Then use the Set joint 1 angle block to move the robotic arm to the initial position: joint 1 angle 0, joint 2 angle 0, joint 3 angle 90, joint 4 angle 0, speed 20.

Next, drag in the repeat ... times block from the Loops category and set the count to 3. Inside the loop, first move to the grasping point: set joint 1 to the variable j1, joint 2 angle 51, joint 3 angle 145, joint 4 angle 0, speed 20. After the arm arrives, Sleep for 3 s, then set Set pump state to Open to pick up the object.
After picking up the object, lift it to the grasping transition point (directly above the grasping point): joint 1 remains j1, joint 2 angle 0, joint 3 angle 90, joint 4 angle 0, speed 20, then Sleep for 1 s. Adjust joint 2 and joint 3 according to the actual height of the object.

Then move to the placement transition point (directly above the placement point): change joint 1 to the variable j1-1, joint 2 angle 0, joint 3 angle 90, speed 20, and Sleep for 1 s. Then lower the arm to the placement point: joint 1 remains j1-1, joint 2 angle 51, joint 3 angle 145. After the arm arrives, Sleep for 1 s, set Set pump state to Close to release the object, and Sleep for another 1 s.

After releasing the object, first lift the arm away from the placement point: joint 1 remains j1-1, joint 2 angle 0, joint 3 angle 90, and Sleep for 1 s. Then run change j1 by 5 and change j1-1 by 5, each followed by Sleep for 1 s, so that the grasping point and placement point of the next object are both offset by 5° along joint 1. Next, use the updated j1 to move above the grasping point of the next object (joint 2 angle 0, joint 3 angle 90). After the three handling cycles are completed, move back to the initial position from the beginning of the program outside the loop. The complete program is shown below.

Similarly, multi-material handling can also be implemented with coordinates. The idea is the same; the complete code is shown below.

Through the introduction of the three cases above, we hope you become more familiar with the Block Programming functions. You can explore more interesting features!