MBC Pathfinder 16-Way (Line16) × mBlock 5(mBot)

Read the Pathfinder in mBlock 5 in three steps

In mBlock 5 for PC, add the MBC Pro Sensors extension v2 and you can read the Pathfinder 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 Pathfinder blocks inside. 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.0.0 is under review on the Makeblock extension platform (being listed), 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 Pathfinder 16-Way (Line16) × mBlock 5 guide.

1

Add the extension and plug in

mBlock needs the MBC Pro Sensors extension v2 first; then a "Pathfinder" 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 Pathfinder 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: once it is listed, search "MBC" in the "Extension Center" and add it. Before it is listed (under review), advanced users can sign in to ext.mblock.cc with their own Makeblock account → My extensions → Import data, upload mbc_pro_sensors_2.0.0_import.mext (about 1 minute), click "Download" to get a .mext, and drag it into the mBlock window.
  3. Six new categories appear: Pathfinder, Ranger, Controller, IMU gyro, Vision and MBC common.
  4. Pathfinder → 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 1 s for the sensor

The program starts at "when mBot starts up". Under it, first put "wait 1 seconds" so the sensor can start; 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.
  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 Pathfinder blocks

In the "Pathfinder" category, the Pathfinder 16-Way (Line16) uses 17 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.

Sensor simulator (looking from behind the robot): drag the black line and watch what the mBot does on the right

The simulator is only a picture. The maths is simpler than the real thing, so a real sensor may be off by a channel or two. The number in each circle is that channel's light value (0 = black, 100 = white). A red ring = that channel sees the line (light value below the threshold 40). Threshold 40, calibration count 1 and firmware version 100 are example values.

An example for every block

25 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. Extension v2 is being listed: MBC Pro Sensors extension v2.0.0 is under review on the Makeblock extension platform. 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, reading blocks give −32768 (never read since power-on) or 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. Direction: stand behind the robot and look forward. Line on the left = negative, on the right = positive. Channel 1 is on the far left.
  5. When the line is lost: when the line leaves the sensor completely, "line position" and "fine line position" give the side where it left (−16 / +16, −100 / +100). To check "I really cannot see a line", use "line width = 0".
  6. Calibrate once first: press the calibrate button on the sensor for about 0.5 s and let go, then within 5 s (while the green light is on) sweep it over the black line and the white mat; or use the "5-second auto calibration" block. The result is kept in the sensor.