🟢 MATRIX Mini R4
MBC MATRIX-edition sensors plug into a Mini R4 I2C port (address 0x22) and are read with the stock "colour sensor" blocks in MATRIXblock; the SharpShot uses the serial port and the stock "mVision" camera blocks. Neither needs any file to be installed or replaced. This page is the overview; each product has its own page at the bottom.
| Method | Products | What to install | What you get |
|---|---|---|---|
| A. Stock blocks (0x22) | Pathfinder 8 / 16, Ranger 2 / 8, IMU, Controller PS2 / PS4 | Nothing, built into MATRIXblock | R, G, B, C, M, Y, K: seven 0~255 numbers |
| B. mVision (serial) | SharpShot Vision (also the legacy school / WRO editions) | Nothing | camera blocks "mVision data 0~9" |
A. Stock blocks (0x22)
The "colour sensor → R / G / B / C / M / Y / K" blocks each return one 0~255 number; the firmware packs the product data into these seven slots.
Warning
Do not use the H / S / V or colour-ID blocks: the host computes them from R, G, B, which is meaningless for MBC products. The grayscale and colour-number blocks were removed by MATRIX, so only these seven slots are usable.
Seven-slot map
| Block | Pathfinder 8 | Pathfinder 16 | Ranger 2 | Ranger 8 | IMU gyro | Controller PS2 / PS4 |
|---|---|---|---|---|---|---|
| R | line position 0~16 (minus 8) | line position 0~32 (minus 16) | left distance cm | sensor 1 cm (far left) | gyro 3D heading low byte | d-pad + shapes |
| G | line width 0~8 | line width 0~16 | right distance cm | sensor 2 (left 60°) | gyro 3D heading high byte | shoulders + functions |
| B | fine position 0~200 (minus 100) | fine position 0~200 (minus 100) | nearest cm | sensor 3 (left 30°) | fused heading low | left stick X 0~99 |
| C | channels 1, 2 reflect | channels 1~4 reflect | 0 | min(sensor 4, sensor 5) (straight ahead) | fused heading high | left stick Y 0~99 |
| M | channels 3, 4 | channels 5~8 | 0 | sensor 6 (right 30°) | gyro 1D heading low | right stick X 0~99 |
| Y | channels 5, 6 | channels 9~12 | 0 | sensor 7 (right 60°) | gyro 1D heading high | right stick Y 0~99 |
| K | channels 7, 8 | channels 13~16 | 0 | sensor 8 (far right) | 0 | connected (1 / 0) |
Decoding
| Product | Block | Decode |
|---|---|---|
| Pathfinder 8 | R / B | line position = R − 8 (negative = line on the left, viewed from behind the robot); fine position = B − 100 |
| C~K | two channels per slot: tens digit = first channel, units digit = second, each 1~9 (1 darkest, 9 brightest) | |
| Pathfinder 16 | R / B | line position = R − 16; fine position = B − 100 |
| C~K | four channels per slot, 2 bits each (0 darkest ~ 3 brightest): channel 1 = ÷64 rounded down, channel 2 = (÷16 rounded down) mod 4, channel 3 = (÷4 rounded down) mod 4, channel 4 = mod 4 | |
| Ranger 2 | R~B | 0~120 cm, 120 = nothing on that side |
| Ranger 8 | R~K | use directly, 0~120 cm (1 cm steps), 120 = nothing in that direction; ordered left to right, C = straight ahead (nearer of sensors 4 and 5 so a narrow object is not averaged away). Find the nearest distance / direction with compare blocks |
| IMU | R~Y | angle = high byte × 256 + low byte − 32768 (keeps counting past 360, left turn negative) |
| Controller | R | up 1, right 2, down 4, left 8, ▲ 16, ● 32, ✕ 64, ■ 128 (add when pressed together) |
| G | L2 1, R2 2, L1 4, R1 8, SELECT 16, L3 32, R3 64, START 128 | |
| B~Y | 0~99, 50 = centre |
// MATRIXblock Arduino mode: stock library, read slot R
int r = MiniR4.I2C1.MXColor.getColor(R); // Pathfinder 8: line position + 8
int linePos = r - 8;B. SharpShot: mVision camera blocks (serial)
MATRIXblock's camera blocks are mVision (Serial1 115200) and HuskyLens only — there is no I2C camera block — so the SharpShot does not use 0x22. It sends data in the mVision packet format: the "mVision data 0~9" blocks each hold one number, one packet every 20 ms.
Warning
Do not use data 10: the MATRIX program declares only 10 slots (data 0~9); slot 10 reads unrelated memory.
For what the current SharpShot Vision sends in each slot, see SharpShot Vision × MATRIX (mVision). The table below is the layout of the legacy editions (school / WRO, no longer supported), kept for teams still using them.
| mVision data | Legacy school edition | Legacy WRO edition (HUE12) |
|---|---|---|
| 0 | hue 0~100 (255 = black / white / grey) | keeps the existing HUE12 packing (12 spot colour codes + vividness); decode as in the HUE12_AS_mVisionSensor_v1.0.8.mbr4 example |
| 1 | saturation 0~100 | |
| 2 | brightness 0~100 | |
| 3 | motion 0~100 | |
| 4 | blob X 0~100 (left → right) | |
| 5 | blob Y 0~75 (bottom → top) | |
| 6 | blob width W 0~100 (0 = not found) | |
| 7 | blob height H 0~75 | |
| 8 | blob area W × H | |
| 9 | blob found 1 / 0 |
Ranges match the EV3 / SPIKE editions, so program logic carries over. The HUE12 example used by WRO 2026 teams is unaffected.
Per-product MATRIX pages
One page per product: wiring figure, the 0x22 seven-slot map (linked to each value's command reference) and the Arduino form.
| Product | MATRIX page |
|---|---|
| Pathfinder 8-Way | line8 × MATRIX |
| Pathfinder 16-Way | line16 × MATRIX |
| Ranger 2-Way | tof2 × MATRIX |
| Ranger 8-Way | tof8 × MATRIX |
| Controller PS2 | ps2 × MATRIX |
| Controller PS4 / PS5 | ps4 × MATRIX |
| IMU gyro | imu × MATRIX |
| SharpShot Vision | SharpShot Vision × MATRIX (mVision) |
| SharpShot Vision legacy (no longer supported) | esp32cam × MATRIX (mVision) |
The EXP6 and Servo6 have no MATRIX edition. Library downloads and files for the other platforms: Downloads.