MBC SharpShot Vision × MBC SPIKE Blocks website

Read SharpShot Vision with the MBC Blocks website in three steps

The MBC SPIKE Blocks website needs no library import: put the setup block (which port, which camera mode) in "run once at start", let the main loop repeat, and read the camera with reading blocks. Work down the steps on the left and watch the blocks grow on the right; the pictures are exported from the website. The website is in Chinese only, so block names here are written as Chinese (English meaning). The hub needs the Pybricks firmware (the website can install it).

Verified on SPIKE hardwareRun on real hubs on 2026-11-01 with shipping firmware v1.0-261101 (Pybricks library and blocks, Pybricks built-in blocks, the official app Education and home edition, MBC Blocks website).

1

Setup block: port + camera mode

From "MBC 感應器 › 神攝手" (MBC sensors › SharpShot Vision) drag the first block, "○ 埠 接 MBC 神攝手 相機模式 …" (port … has MBC SharpShot Vision, camera mode …), into "開機時執行一次" (run once at start). It tells the program which port has the camera and which mode it is in (MBC sensors report the same ID as a LEGO color sensor, so this block is required).

Which port is the camera on?
  1. Pick the camera mode: choose it in the camera's MODE menu, click the same mode number below, and pick it in the setup block's "相機模式" (camera mode) menu.
2

Main loop: repeat forever

Blocks in "主迴圈" (main loop) repeat forever. Put "等待 100 毫秒" (wait 100 ms) at the end to read every 0.1 s (a new project already has the main loop).

3

Use the reading blocks

Reading blocks are in "MBC 感應器 › 神攝手"; set the port at the front to the same port as the setup block. Functions are grouped by camera mode; dashed ones belong to another mode (clicking one switches it for you). Click a function and the blocks and output switch to its example.

Simulated camera view: drag things in the picture and watch the output change

The view is a sketch: values come straight from where things are on screen (X 0–159 left→right, Y 0–119 top→bottom, area % = width × height ÷ whole picture); a hue code is the color the paper or block really has (red 0, yellow 40, green 80, blue 160, purple 200, white table 244, black tape 252). It is not the camera's own algorithm, and real numbers vary with the light. Color tracking assumes 4 colors were taught on the camera: color 1 red, 2 green, 3 blue, 4 yellow. In object detection you pick each shape yourself (the camera does not judge it here); objects 1, 2… are sorted by area, largest first; X, Y is the shape's centroid (white dot), the dashed box is its bounding box, and the angle is the rotation you set.

An example for every function

Every function has a set of blocks to copy (port C); the badge shows which modes it works in. "Try it" jumps to step 3 (and switches the mode if needed).

Full examples

Whole programs (turn toward a blob, line following) are in the MicroPython tutorial; the website generates the same calls as the Pybricks library (multitask style).

Good to know

  1. Same functions as the Pybricks library. The reading blocks call MBC_UniCam.py directly (the website uploads it for you); each block is one library function, plus a "shape name" block.
  2. The camera mode must match in three places: the camera menu, the setup block's camera mode, and the reading blocks you use. A block the mode does not have raises ValueError when it runs (the message says which mode to use).
  3. Unplugging does not stop the program. Readings keep the last value (or None if never read) and the terminal prints one warning line; use "感應器有接好" (sensor connected) to check.
  4. The port monitor does not show SharpShot Vision values. Use the reading blocks and watch the terminal.
  5. Directions: X 0–159 left→right, Y 0–119 top→bottom (top = small); line offset: left = negative, right = positive (looking forward from behind the robot). Colors are taught on the camera; the program cannot change them.