Program mBot Neo with mBlock 5

mceclip0.png

 

This page describes how to use mBlock 5 to program mBot Neo. Follow the following steps:

1. Download and install the required software

2. Connect mBot Neo to mBlock 5

3. Add extensions

4. Set the programming mode

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

5.1 Example programs

5.2 Block comments

5.3 Block help

5.4 Learn Python based on blocks

5.5 Python programming

 

1. Download and install the required software

To program mBot Neo with mBlock 5, you can use the mBlock 5 PC client, mBlock 5 on the web, or the mBlock 5 mobile app.

PC client

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

mBlock_5icon.png

mBlock 5 for Windows

mBlock 5 for Mac

 

On the web

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

mBlock_5icon.png

mLink2 for Windows

mLink2 for Mac

mLink for Chromebook

 

Note:
Google Chrome is recommended. To download Google Chrome, click Google Chrome.

 

Mobile app

To use mBlock 5 on mobile devices, use your phone or tablet to scan the QR code or search for "mBlock" in app stores to download the app.

mBlock-5-mobile.png mceclip0.png

 

2. Connect mBot Neo to mBlock 5

Before programming mBot Neo, you need to connect it to mBlock 5.

Refer to the following instructions according to your mBlock 5 version:

mBlock_5icon.png Connect mBot Neo to the mBlock 5 PC client

(1) Use a Micro USB cable (Type-C) to connect mBot Neo to your PC, and power on mBot Neo.

mceclip1.png

(2) Double-click the mBlock 5 icon on your PC to open it.

mceclip0.png

(3) On the Devices tab, click + add, select CyberPi, and click OK.

mceclip1.png

(4) Click Connect to connect CyberPi to mBlock 5.

mceclip0.png

A message is displayed after CyberPi is connected, indicating that the connection is successful.

mceclip2.png


icon.ico Connect mBot Neo to mBlock 5 on the web

(1) Use a Micro USB cable (Type-C) to connect mBot Neo to your PC, and power on mBot Neo.

mceclip1.png

(2) Double-click the mLink 2 icon on your PC to open it.

mceclip1.png

(3) Click Create now in the mBlock block-based editor area to open mBlock 5 on the web.

mceclip0.png

(4) Click the Devices tab, click + add, select CyberPi, and click OK.

mceclip1.png

(5) Click Connect to connect CyberPi to mBlock 5.

mceclip0.png

A message is displayed after CyberPi is connected, indicating that the connection is successful.

mceclip2.png


mBlock-5-mobile.png Connect mBot Neo to the mBlock 5 app on your mobile device

(1) Enable Bluetooth on your mobile device.

(2) Turn on mBot Neo.

mceclip7.png

(3) Open the mBlock 5 app on your mobile device, and tap Coding.

mceclip3.png

(4) Tap +, select CyberPi, and tap .

mceclip4.png

(5) Tap CyberPi, tap Connect, and put your phone or tablet close to mBot Neo.

mceclip6.png

mBlock 5 searches for CyberPi through Bluetooth and connects to it.

mceclip8.png

(6) Tap Back to coding.

 

Now, you can start to program mBot Neo by dragging blocks to the area on the right!

3. Add extensions

Besides the main control board CyberPi, mBot Neo uses mBot2 Shield, Ultrasoinc sensor 2, quad RGB sensor, and encoder motors. Therefore, to program mBot Neo, you need to add the corresponding extensions.

(1) Add the mBot2 extension.

mceclip2.png

After adding the extension, you can see and use the blocks.

mceclip9.png

(2) Add the Ultrasonic Sensor 2 and Quad RGB Sensor extensions in the same way.

mceclip10.png

Tips: You can add extensions on mBlock 5 on your PC, on the web, or on your mobile device in the similar way.

4. Set the programming mode

mBlock 5 provides two programming modes, namely Live and Upload. You can click to switch the modes.

mceclip11.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 CyberPi 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 CyberPi. After being successfully uploaded, the program can still run properly on CyberPi when it is disconnected from mBlock 5.

 

Now you can start to program mBot Neo!

5. Tips for using mBlock 5

5.1 Example programs

You can understand the functions of mBot Neo through example programs.

On mBlock 5, choose Tutorials > Example Programs and click mBot2 to view example programs provided for mBot Neo.

mceclip1.png

5.2 Block comments

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

mceclip1.png

5.3 Block help

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

mceclip0.png

5.4 Learn Python based on blocks

mBlock 5 provides two programming languages for mBot Neo, namely block-based programming and Python. In Upload mode, you can click the buttons on the right to switch the programming languages.

mceclip1.png

In addition, when programming mBot Neo in Upload mode, you can click the switching button on the right to view the corresponding Python statements (obtained by converting the blocks).

mceclip2.png

5.5 Python programming

Open mLink2 and click Create now in the mBlock Python editor section.

mceclip12.png

For details about how to program mBot2 on mBlock-Python Editor, see mBlock-Python Editor Online Help.

Was this article helpful?
2 out of 3 found this helpful

Comments

0 comments

Please sign in to leave a comment.