Line Follower 16-ch × MATRIX Mini R4
The MATRIX edition of the Line Follower 16-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 + 16 | subtract 16 |
| B | fine position + 100 | subtract 100 |
| G | line width | |
| C | channel 1~16 reflect 1~2 | C |
| M | channel 1~16 reflect 3~4 | C |
| Y | channel 1~16 reflect 5~6 | C |
| K | channel 1~16 reflect 7~8 | C |
// MATRIXblock → Arduino:stock library
int r = MiniR4.I2C1.MXColor.getColor(R); // line position + 16Sources and assumptions
Generated by _build/gen-reference.mjs from _build/protocol/line16.json (single source of truth, transcribed from the 2026-10-21 protocol decisions).
- B-11:細位置 02 與線位置 01 同號(負 = 左);韌體 F16:1290 註解寫反,程式碼同號(IR:11 為準)。
- B-12:E7 五秒動態校準補回(v1 的 0x20=0x01),定案表沒列。
- EV3:模式 0~2 鎖住;模式 3 原本不送 → 16 bit 位元圖;模式 4 原本不送 → 同模式 2;模式 5 ID 格式 B(共用函式)。
- SPIKE:0/5/7/9 鎖住,1
4、6 維持不動;教育版模式 0 的 16 路光值是 2-bit(玩具版 1-bit),跟 8 路的 4-bit 不同;byte 815 補 0(#65 已改,使用者保留);模式 9 排法照盤點(四路 4-bit 一個 int16,v6 = 位元圖);模式 8 v[0] 改 ID|hw[0]<<8。 - 線段數 04 範圍:定案沒寫,16 路最多 8 段(交錯壓線),採 0~8。
- mBlock 舊版:MBC_MBLOCK_LEGACY=1 時逐 byte 同 2026-10-21 統一後韌體(0x01 位置、0x02 線寬、n<<4|03 反向兩路壓一 byte、0x07 細位置 0~200),0x0B 回 1(B-1)。
- Flash:C031 硬體鎖 28 KB,I2C 版餘 848 B;不夠時照 B-17 順序瘦身,JSON 不受影響。