MBC SharpShot Vision × mBlock 5(mBot)

Read the SharpShot Vision in mBlock 5 in three steps

In mBlock 5 for PC, add the MBC Pro Sensors extension v2.2.0 and you can read the SharpShot Vision on an mBot with blocks. First add the extension and plug into a port. Then, under "when mBot starts up", wait for the sensor to start and add "forever". Last, put the blocks from the "SharpShot Vision" category inside (not "legacy"). Follow the steps on the left, and the blocks on the right grow with you. The mBot has no screen, so the examples use the buzzer, the LED and the wheels to show you what was read.

Extension v2.2.0 is still in development and not listed yet, so its blocks cannot be exported from mBlock yet. The block pictures on this page are drawn with scratchblocks from the extension's own block text and category colours, so they look about the same as in mBlock. On the right you can switch to "Arduino program". For every value's number and range, see SharpShot Vision × mBlock 5 guide.

1

Add the extension and plug in

mBlock needs the MBC Pro Sensors extension v2 first; then a "SharpShot Vision" category appears in the block palette. Every block has a port menu: pick the number the sensor is really plugged into, and the extension uses the right pins for your board.

Which mBot port is the SharpShot Vision plugged into?
  1. Open mBlock 5 for PC, add mBot under "Devices" at the bottom left, and switch the mode toggle at the bottom right to Upload.
  2. Add the extension: the new extension is in development; once it is officially listed, search "MBC" in the "Extension Center" and add it. Before that you can try the import file (not yet hardware-verified): sign in to ext.mblock.cc with their own Makeblock account → My extensions → Import data, upload mbc_pro_sensors_2.2.0_import.mext (about 2 minutes), click "Download" to get a .mext, and drag it into the mBlock window.
  3. Seven new categories appear: Pathfinder, Ranger, Controller, IMU Gyro, SharpShot Vision (legacy), SharpShot Vision and MBC common (object detection needs v2.2.0; "legacy" is for the school / WRO editions).
  4. SharpShot Vision → mBot adapter → mBot port 1; pick port 1 on the blocks too.
BoardUsable portsNotes
mBot (mCore)1, 2, 3, 4all four ports
mBot Ranger (Auriga)6 ~ 101 ~ 4 are red motor ports, 5 is the serial port
Orion3, 4, 61, 2 are red motor ports; 7, 8 are analog only
Ultimate 2.0 (MegaPi)6, 7, 8needs the RJ25 adapter board; 5 is the serial port
MegaPi Pro7, 8, 9, 10needs the RJ25 adapter board

The simulator here covers the mBot only (ports 1 ~ 4). For another board, swap "when mBot starts up" for that board's start block and use one of its usable ports. mBot2 (CyberPi) has no RJ25 port and is not supported.

2

Start-up: wait 2 s for the sensor

The program starts at "when mBot starts up". Under it, first put "wait 2 seconds" so the sensor can start (the camera initialises its lens and screen); reading too early gives −32768. Then add "forever", because you read a sensor again and again.

  1. From "Events", drag out "when mBot starts up".
  2. From "Control", drag "wait (1) seconds" under it and change the number to 2.
  3. From "Control", drag "forever" to the bottom.

In Upload mode the program is flashed into the mBot, so it also runs on battery with the USB cable unplugged. You do not need a wait inside "forever": every reading block waits for the sensor's answer (at most 0.01 s).

3

Use the SharpShot Vision blocks

In the "SharpShot Vision" category, the SharpShot Vision uses 37 blocks (values, true/false and commands), and "MBC common" has 8 more. Every block's port must be the same number as in step 1 (1). Click a function, and the blocks, the Arduino program and what the mBot does on the right change to its example.

Camera simulator: pick a camera mode, drag the blob or the line, and watch what the mBot does
Camera mode now (switches by itself when the card program has "set mode")
Colour tracking
Colour pick
Colour order
Line follow
Object detection

The simulator is only a picture: the maths is simplified and is not the camera's own algorithm; a real camera varies a little with the light. The picture is 160 × 120 pixels, X left → right 1-159, Y top → bottom 1-119, 0 = no target. Crosses = colour-pick sample points (1-16). Two colours are taught (colour 1 with adjustable hue, colour 2 green); firmware version 100 is an example value. In object detection you pick the shape yourself (the camera does not judge it here); objects 1, 2… are sorted by area, largest first; white dot = centroid, dashed box = bounding box, the angle is the rotation you set; "Add colour 2" = a colour 2 square, "Another blob of the same colour" = a smaller copy of the object.

An example for every block

45 blocks (including "MBC common"). Each one has an example you can copy (port 1). Press "Try it" to jump to step 3. The blocks and what the mBot does on the right change to that example.

Good to know

  1. New extension in development: MBC Pro Sensors extension v2.2.0 (the "SharpShot Vision" category, with object detection) is still in development; before it is officially listed you can download the import file to try it (not yet hardware-verified). Once it is listed, search "MBC" in the mBlock 5 "Extension Center" to add it. The sensor must be the Makeblock edition with protocol v2 firmware (from 2026-10). Firmware from before 2026-10 needs the legacy extension v1.0.0, and the old and new blocks do not mix (read the "protocol version" block: 2 means new firmware). See MakeBlock extension.
  2. When nothing can be read: if the port cannot be used or the sensor is not connected, the "SharpShot Vision" reporters give −32768 (the "MBC common" ones keep the last value read), and the program keeps running. "MBC common → connected?" is false. Check the cable with it first, then look at the values.
  3. The matching Arduino program: switch the right panel to "Arduino program" to see an Arduino sketch that does the same as the blocks (the MBC_Sensors v2 library, the same one the extension uses, plus the Makeblock library). Every example has been compiled (board: Arduino Uno). See MakeBlock extension for how to install the libraries.
  4. Set the mode first: the same value id means different things in different camera modes, so the reporters ask the camera for its mode first and give −32768 in the wrong one. Putting "set mode" at the start is safest (it is stored in the camera).
  5. Colours are taught on the camera only: stop on target 1-16 and press OK; "colour n" is target n on the camera.
  6. v1 not yet hardware-verified: the mBlock firmware of the SharpShot Vision has only been tested on a PC, not on an mBot yet; real-world numbers may change after testing.