MBC Pathfinder 16-Way × official LEGO SPIKE App

Read the Pathfinder 16-Way with the official LEGO SPIKE App in three steps

In the official LEGO SPIKE App (Education edition, SPIKE 3), the Pathfinder 16-Way shows up as a Color Sensor. So you do not import a library: you read it with the Color Sensor blocks and then convert the numbers into line position and line width. Work through the steps on the left and the blocks on the right grow with you. These block pictures were built and exported straight from the official web App (spike.legoeducation.com), so they look exactly like the App.

1

Start: program start + repeat forever

You need to read the sensor again and again. First place the yellow "when program starts" block and attach "forever" under it. Put "wait 0.1 seconds" inside, so it reads every 0.1 seconds.

  1. Open the official LEGO SPIKE App, make a new project and choose "Word Blocks".
  2. Drag "when program starts" from "Events". Then drag "forever" from "Control" and attach it underneath.
  3. Drag a "wait 1 seconds" block into forever and change the number to 0.1.
2

Meet the three reading blocks and pick the right port

The official App reads the Pathfinder 16-Way with three Color Sensor blocks. Each block starts with a port drop-down: pick the port the Pathfinder is plugged into. You must convert the numbers you read to get the line position:

Which port is the Pathfinder plugged into?
Official blockWhat you getConversion
reflected light (in Sensors)line position (coarse) + 16subtract 16 from the reading → -16 to 16
color (in Sensors)line width (how many channels are on the line)use it as it is → 0 to 16, 0 = no line
raw red (in the "More Sensors" extension)line position (fine) + 100subtract 100 from the reading → -100 to 100

To use raw red, first press the extension button at the bottom left of the App and add "More Sensors".

3

Store it in a variable and use it

In "Variables", make a new variable (for example "line position"). Use "set … to …" to store the converted value in it. This gives the value a name. After that, use this variable to show the value or to test it. Click a function and the blocks and result change to its example.

Sensor simulator (looking forward from behind the robot): drag the black line and watch the result on the right change

The simulator is only a sketch: the conversion is simplified, so a real sensor may differ by one or two steps. The darker the circle, the darker that channel sees. Red ring = that channel counts as on the line.

Block example for each function

Every function the official App can read has a set of blocks you can copy (port C). Press "Try it" to jump to step 3.

What the official App cannot read: the official App only reads the sensor's "combined data". So it cannot read the Pathfinder 16-Way's line segments, light value of each channel (raw green / blue only hold a rough 0 to 3 that you would have to split into bits; not for beginners), which channels are on the line, sensor ID, firmware version or sensor connected. For these, use the MBC SPIKE Blocks website or Pybricks (the hub needs Pybricks firmware).

Things to know

  1. In the official App, use the "Color Sensor" blocks. To the official App, the Pathfinder 16-Way is just a Color Sensor. You do not need to install anything.
  2. Always convert. Subtract 16 from reflected light and 100 from raw red to get the line position. If you forget, the number is always positive (with the line in the centre, reflected light is 16).
  3. Check "is there a line?" with line width. Line width = 0 means no line. When the line leaves completely, line position stays at the side where it left (-16 / 16).
  4. Crossroads: line width is 11 or more (the whole row on black), so the example uses "line width > 10". This page is for the Education edition (SPIKE 3). In the home edition (Robot Inventor), "color" only goes up to 10, so use "line width > 9" for a crossroads (tested 2026-10). In the Education hub test (2026-10-29), "color" showed NaN once the width went above 10, and the 16-way crossroads stop in blocks is still being re-tested; to be sure it stops, use SPIKE App Python for now.
  5. Direction: stand behind the robot and look forward. A line on the left gives a negative number, a line on the right gives a positive number. Channel 1 is on the far left.