Versions Compared

Key

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

Table of Contents
Installing mBlock Software

...

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.

This is illustrated using an example for 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. For this, you can follow 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.

The official tutorial is found here - https://www.mblock.cc/doc/en/quick-start/role-device.html. 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). A more detailed description is given below.

Upload mode

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

...

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<Arduino.h>