Import the library, pick the camera mode
Check first: Pybricks block coding needs a license code or a Patreon membership. Without one, write MicroPython instead; it is exactly the same (switch the right panel to "MicroPython", or see the MicroPython tutorial).
The first thing in a block program is a red "from … import …" block under the yellow "set up" block: it tells Pybricks to use the SharpShot Vision library.
- Download the library (save the file and keep its name): MBC_UniCam.py. The file name is
MBC_UniCam.py. - In Pybricks Code press "Import a file" in the file list and import it into the same project; keep the file name.
- Press "+" to add a file and choose blocks.
- Drag the red "from … import …" block under "set up" and pick
MBC_UniCamandUniCam. - Pick the camera mode: choose the camera mode and sub-option in the camera's MODE menu and click the same mode number below (mode number = camera mode × 10 + sub-option); step 2 puts it in the block.
Rather not import a library? Pybricks' own color sensor blocks (reflection, ambient) read part of it (1–2 colors or spots per mode); see the "Pybricks blocks" column of the value reference.