This page describes how to use mBlock 5 to program mBot Neo. Follow the steps below:
1. Download and install the required software
2. Connect mBot Neo to mBlock 5
In addition, you can use mBlock 5 by referring to the following tips:
5.4 Learn Python based on blocks
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 app.
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.
Mobile app
To use mBlock 5 on mobile devices, you can use your phone or tablet to scan the QR code below or search for mBlock in the App Store to download the app.
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:
- Connect mBot Neo to the mBlock 5 PC client
- Connect mBot Neo to mBlock 5 on the web
- Connect mBot Neo to the mBlock app on your mobile device
Connect mBot Neo to the mBlock 5 PC client
(1) Use the original USB cable to connect mBot Neo to your PC, and power on mBot Neo.
(2) Launch mBlock by double-clicking the mBlock 5 icon on your PC.
(3) On the Devices tab, click + add, select CyberPi, and click OK.
(4) Click Connect to connect CyberPi to mBlock 5.
A message is displayed after CyberPi is connected, indicating that the connection is successful.
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.
(2) Double-click the mLink 2 icon on your PC to open it.
(3) Click Create now in the mBlock block-based editor area to open mBlock 5 on the web.
(4) Click the Devices tab, click + add, select CyberPi, and click OK.
(5) Click Connect to connect CyberPi to mBlock 5.
A message is displayed after CyberPi is connected, indicating that the connection is successful.
Connect mBot Neo to the mBlock app on your mobile device
(1) Enable Bluetooth on your mobile device.
(2) Turn on mBot Neo.
(3) Open the mBlock app on your mobile device, and tap Coding.
(4) Tap +, select CyberPi, and tap √.
(5) Tap the CyberPi icon, tap Connect, and put your phone or tablet close to mBot Neo.
mBlock 5 searches for CyberPi through Bluetooth and connects to it.
(6) Tap Back to coding.
Now, you can start to program mBot Neo by dragging blocks to the scripts 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 extension mBot2 shield.
After adding the extension, you can see and use the blocks.
(2) Add the extensions Ultrasonic Sensor 2 and Quad RGB Sensor in a similar way.
Tips: You can add extensions on mBlock 5 on your PC, on the web, or on your mobile device in a similar way.
4. Set the programming mode
mBlock 5 provides two programming modes, namely Live and Upload. You can click to switch the mode.
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.
5.2 Block comments
You can read the block comments in an example program to better understand its function and operation.
5.3 Block help
If you don't understand a block when using it, you can right-click it and click Help that appears.
5.4 Learn Python based on blocks
mBlock 5 provides two programming methods for mBot Neo, namely block-based programming and Python programming. In Upload mode, you can click the buttons on the right to switch the programming method.
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).
5.5 Python programming
Open mLink2 and click Create now in the mBlock Python editor section.
For details about how to program mBot2 on mBlock-Python Editor, see mBlock-Python Editor Online Help.
Comments
Please sign in to leave a comment.