Programming mBot Ranger with mBlock 5

1. Download and install the required software

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

 

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

mBlock 5 for Windows

mBlock 5 for Mac

 

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

mLink2 for Windows

mLink2 for Mac

mLink for Chromebook

 

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

2. Connect mBot Ranger to mBlock 5

You can connect mBot Ranger to mBlock 5 through a USB cable or Bluetooth 4.0.

Using a USB cable

Using Bluetooth 4.0

In the following operation, mBlock 5 PC client is used. If you use mBlock 5 on the web, open mLink 2 and perform the same steps.

Using a USB cable

(1) Use the USB cable delivered with mBot Ranger to connect your mBot Ranger to a USB port of you computer.

(2) Power on your mBot Ranger.

(3) On mBlock 5, click + on the Devices tab, select mBot Ranger in Device Library, and click OK.

mceclip0.png

(4) Click Connect. On the dialog box that appears, click the USB tab and click Connect.

mceclip1.png

mBot Ranger is successfully connected to mBlock 5 when the message indicating successful connection is displayed.

mceclip3.png

Using Bluetooth 4.0

System requirements:

  • Windows: The version of Bluetooth must be 4.0; for other Bluetooth versions, a Bluetooth 4.0 adapter is recommended (refer to Bluetooth Dongle for detailed instructions).
  • Mac OS: Most of Mac OS models are supported.

(1) Power on your mBot Ranger.

(2) Turn on the Bluetooth on your PC.

  • Windows: On the task bar, select action center > Bluetooth.
  • Mac OS: Choose Apple menu > System Preferences, then click Bluetooth.

(3) On mBlock 5, click + on the Devices tab, select mBot Ranger in Device Library, and click OK.

mceclip0.png

 

(4) Click Connect. On the dialog box that appears, click the Bluetooth tab and click Connect after your mBot Ranger is found.

mBot Ranger is successfully connected to mBlock 5 when the message indicating successful connection is displayed.

mceclip3.png

3. Set the programming mode

mceclip2.png

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

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

 

Now, you can start to program mBot Ranger by dragging blocks to the scripts area.

4. Set the programming language

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

mceclip12.png

In addition, when programming mBot Ranger in the block-based language in Upload mode, you can click the switching button on the right to view the corresponding Arduino C statements (obtained by converting the blocks).

mceclip3.png

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

Comments

0 comments

Please sign in to leave a comment.