Line Follower 8-ch × MATRIX Mini R4
The MATRIX edition of the Line Follower 8-ch plugs into a Mini R4 I2C port at address 0x22 and is read with the stock colour-sensor blocks: no library change, RK = seven 0255 numbers.
SPIKEEV3Arduino I2CmBlockMATRIXmicro:bit
Wiring
Use the stock MATRIX 4-pin sensor cable on I2C1 or I2C2 and pick that port in the block.
A. Stock blocks (0x22)
The "colour sensor → R / G / B / C / M / Y / K" blocks each return one 0~255 number. ⚠️ Do not use the stock H / S / V or colour-ID blocks (the host computes them from R, G, B; meaningless here); the grayscale and colour-number blocks were removed by MATRIX.
| Block | Content | Decode |
|---|---|---|
| R | line position + 8 | subtract 8 |
| B | fine position + 100 | subtract 100 |
| G | line width | |
| C | channel 1~8 reflect 1~2 | C~K 兩路一組 convert9×10+convert9 |
| M | channel 1~8 reflect 3~4 | C~K 兩路一組 convert9×10+convert9 |
| Y | channel 1~8 reflect 5~6 | C~K 兩路一組 convert9×10+convert9 |
| K | channel 1~8 reflect 7~8 | C~K 兩路一組 convert9×10+convert9 |
// MATRIXblock → Arduino:stock library
int r = MiniR4.I2C1.MXColor.getColor(R); // line position + 8Sources and assumptions
Generated by _build/gen-reference.mjs from _build/protocol/line8.json (single source of truth, transcribed from the 2026-10-21 protocol decisions).
- B-11:細位置 02 與線位置 01 同號(負 = 左);v1 韌體註解寫反,程式碼同號。
- B-12:E7 五秒動態校準補回(v1 的 0x20=0x01),定案表沒列。
- SPIKE 教育版模式 0 的 byte 8~15 補 0(#65 已改,使用者保留)。
- EV3 模式 4 與模式 2 相同內容;模式 3 改壓線位元圖(#67)。
- mBlock 舊版:MBC_MBLOCK_LEGACY=1 時逐 byte 同 2026-10-21 統一後韌體,0x0B 回 1。