Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
Installing mBlock Software


httphttps://www.mblock.cc/en/mblock-softwaredownload/.

  • Install the latest version for PC (V5.4.0x).
  • You will need to install the driver when prompted by clicking INSTALL, as well as Allow access when you get a firewall warning.

Getting Started with mBlock Software

mBlock software getting started main page is here - https://wwwsupport.mblockmakeblock.cccom/dochc/en-us/quick-start/quick-start.html. Follow this page as well as the next two pagessections/360001829013-mBlock-5

Let us first gain some familiarity by playing with sprites before we start using mBlock for the actual device

Now, it is time to play with the actual device (mBot/mCore). The steps here - We will be using a USB cable (and not Bluetooth or a 2.4G module). The official tutorial is here - https://wwwsupport.mblockmakeblock.cccom/dochc/en-us/quick-start/connect-device.html show a device called HaloCode and not our beloved mBot. Hence, the steps are slightly different, which is given below (the steps below are mostly similar to http://docs.makeblock.com/mbot/en/tutorials/quick-start.html).articles/1500003954802-Program-mBot-with-mBlock-5. However, you may wish to follow the slightly more detailed instructions below.

The default device after installation will be CyberPi and not mBot. You can delete the CyberPi and then click 'add'. 

...

Get familiarized with both Upload mode and Live mode - read more at the difference between modes here - https://wwwsupport.mblockmakeblock.cccom/dochc/en/hardware-basic/mode.html-us/articles/1500003954802-Program-mBot-with-mBlock-5#3.%20Set%20the%20programming%20mode.

Live mode

Select the mode (say, Live mode for now) and click Connect after ensuring that mBot/mCore is powered on. You will then be prompted to select the port.

...

Play with other blocks, and see the various inputs/outputs in action! You can see details of other blocks applicable for mBot under Block Reference section in http://docs.makeblock.com/mbot/en/.

Interaction between Devices and Sprites

Enabling your mBot/mCore to interact with sprites is useful to make the sprite (say, Panda) read out sensor values. For this, you can follow The official tutorial is found here - https://wwwsupport.mblockmakeblock.cccom/dochc/en/quick-start/role-device.html. -us/articles/4410698813463-Enable-a-Device-to-Interact-with-a-Sprite-on-mBlock-5. Note that here too, you can use instead of the 'when button is pressed' mentioned in that page (which is for HaloCode device and not mBot)CyberPi and not mBot). A more detailed description is given below.

Here we have an example of reading the light sensor on the Device (mBot)and making the Sprite (Panda) display the reading.

Create a new variable from the Image Added tab. Select 'For all sprites'

Image Added

Create your program similar to the one shown below for the device (mBot).

Image Added

Note that the broadcast block is available under Image Added. Here, we created a message with a  meaningful name 'new_light_reading'.

For the sprite (Panda), create a program similar to the one below.

Image Added

The variable 'light_reading' will be available for the sprite as well.

Now, click the flag and the sprite (Panda) will say the new reading when it is made available by the device (mBot), which will be once a second.

Upload mode

Note that in Upload mode, the only available is , which isn't available in Live mode.

...

You can try out the various examples here using mCore - http://www.mblock.cc/example/introduction/:
Image Added

Arduino C in mBlock

mBlock can also handle Arduino C directly. You can't see l switch between using blocks and using code seamlessly though. Make sure you include include #include<Arduino.h>