Vision Sensor (WRO Edition, HUE12) × micro:bit (MakeCode extension)
Back to Vision Sensor (WRO Edition, HUE12)
The universal I2C edition of the Vision Sensor (WRO Edition, HUE12) works with BBC micro:bit V1 / V2 through the MakeCode extension pxt-mbc-sensors v2 (which speaks MBC I2C protocol v2). Installation and hardware notes (3.3 V, power): micro:bit overview.
SPIKEEV3Arduino I2CmBlockMATRIXmicro:bit
Important
Extension v2 is not yet verified on hardware; block names follow the published release: https://github.com/contactmbcrobot/pxt-mbc-sensors
Wiring
| Sensor | micro:bit |
|---|---|
| SDA(RX) | P20 |
| SCL(TX) | P19 |
| VCC | must use external 5 V (share GND with the micro:bit) |
| GND | GND |
Reporter blocks
| Block | Returns | Id | Meaning |
|---|---|---|---|
| camera spot [1~12] colour code | 0~255 | 10~1B |
10 |
| camera spot [1~12] vividness | 0~255 | 20~2B |
20 |
More blocks (yes / no, events)
| Block | Related value |
|---|---|
| camera spot [1~12] is [colour] | 10~1B |
Status
| bit | Name | Meaning |
|---|---|---|
| b0 | ready (ready) |
always 1; b1 = 0 (the WRO edition has no 'blob found') |
JavaScript
if (!(mbc.waitReady(0x4C, 3000))) {
basic.showIcon(IconNames.No) // nothing answers: check wiring and power
}
basic.forever(function () {
basic.showNumber(mbc.camSpotColor(1)) // spot 1~12 colour code
basic.pause(100)
})Sources and assumptions
Generated by _build/gen-reference.mjs from _build/protocol/cam_wro.json (single source of truth, transcribed from the 2026-10-21 protocol decisions).
- hw0 = 2(共識 #6:神攝手 2 = WRO 版);model = HUE12(樂高模式名)。
- I2C 0x4C 與學校版同一位址(主機用 F0 高 byte 1/2 分辨);D4:SDA = IO3、SCL = IO1,與 EV3/SPIKE 串口模式二選一編譯;ESP32 從機 onReceive 預載 32 B;上機待測。mBlock 用 Serial.begin(38400, SERIAL_8N1, 3, 1)。
- 值表只有 10
1B、202B(mBlock 定案);兩群各 12 個,I2C 一次連續讀 12 個值(24 B)剛好一群。 - EV3/SPIKE 只有一個模式 HUE12(type 95,動態描述表 DATA32×8),鎖住照盤點 §0-2 排法;沒有 ID 模式(type 95 只宣告 1 個模式,不加)。
- mVision 鎖住照盤點 §4:[0xAA][9][18 B][xor],byte 0
11 顏色碼、1217 鮮豔度 4 bit;WRO 隊伍的 HUE12_AS_mVisionSensor_v1.0.8.mbr4 在用,不動;B-6:不節流(每圈 loop 送)。 - mVision 的鮮豔度是 S>>4(0
15),值表 202B 是完整 0~255;兩者不同是既有設計,不改。 - 顏色碼 255 只代表「色點沒開」,不代表「沒找到」(沒抓到時仍回種子點顏色,盤點 §0-1)。
- 不做 0x22(hosts.matrix = false);沒有寫入命令;F3 只有 b0。
- The extension reads
Int16LEand pauses 2 ms after writing the id (D5); with no sensor answering, reporters return 0 and yes / no blocks return false.