Program mBot2 Rover with mBlock 5

Program mBot2 Rover with mBlock 5.png
This page describes how to use mBlock 5 to program mBot2 Rover. Follow the steps below:

 

In addition, you can use mBlock 5 by referring to the following tips: 

 

1. Download and install the required software

To program mBot2 Rover with mBlock 5, you can use the mBlock 5 PC client or mBlock 5 on the web.

PC client

To use the mBlock 5 PC client, you need to download and install it.

On the web

To use mBlock 5 on the web (https://ide.mblock.cc), you need to download and install mLink 2.
Note:
Google Chrome is recommended. To download Google Chrome, click Google Chrome.

2. Connect mBot2 Rover to mBlock 5

Before programming mBot2 Rover, you need to connect it to mBlock 5.
Refer to the following instructions according to your mBlock 5 version:

Connect mBot2 Rover to the mBlock 5 PC client

(1) Use the original USB cable to connect mBot2 Rover to your PC, and power on mBot2 Rover.
连接PC.png
(2) Launch mBlock by double-clicking the mBlock 5 icon on your PC.
4.png
(3) On the Devices tab, click + Add, select mBot2 Rover, and click OK.
已补红框.png
(4) Click Connect to connect mBot2 Rover to mBlock 5.
6.png
A message is displayed after mBot2 Rover is connected, indicating that the connection is successful.
13.png

icon.ico Connect mBot2 Rover to mBlock 5 on the web

(1) Use the original USB cable to connect mBot2 Rover to your PC, and power on mBot2 Rover.
连接PC.png
(2) Double-click the mLink2 icon on your PC to open it.
9.png
(3) Click Create now in the mBlock block-based editor area to open mBlock 5 on the web.
333.png
(4) Click the Devices tab, click + Add, select mBot2 Rover, and click OK.
已补红框.png
(5) Click Connect to connect mBot2 Rover to mBlock 5.
12.png
A message is displayed after CyberPi is connected, indicating that the connection is successful.
13.png

3. Set the programming mode

mBlock 5 provides two programming modes, namely Live and Upload. You can click to switch the mode.
14.png
Live: In this mode, you can view the program execution effect in real time, which facilitates the debugging of the program. In this mode, you must keep mBot2 Rover connected to mBlock 5. If they are disconnected, the program cannot be executed.
Upload: In this mode, you need to upload the compiled program to mBot2 Rover. After being successfully uploaded, the program can still run properly on mBot2 Rover when it is disconnected from mBlock 5.
Now you can start to program mBot2 Rover!

4. Tips for using mBlock 5

4.1 Example programs

You can understand the functions of mBot2 Rover through example programs.
On mBlock 5, choose Example Programs and click mBot2 Add-on Packs to view example programs provided for mBot2 Rover.
Example Programs - mBot2 Add-on Packs.png

4.2 Block comments

You can read the block comments in an example program to better understand its function and operation.
16.png

4.3 Block help

If you don't understand a block when using it, you can right-click it and click Help that appears.
17.png

4.4 Learn Python based on blocks

mBlock 5 provides two programming methods for mBot2 Rover, namely block-based programming and Python programming. In Upload mode, you can click the buttons on the right to switch the programming method.
22.jpg
In addition, when programming mBot2 Rover in Upload mode, you can click the switching button on the right to view the corresponding Python statements (obtained by converting the blocks).
19.png

4.5 Python programming

Open mLink2 and click Create now in the mBlock Python editor section.
20.png
For details about how to program mBot2 Rover on mBlock-Python Editor, see mBlock-Python Editor Online Help.

 

 

 

 

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.