set up: create the color sensor, pick the port and mode
Check first: Pybricks block coding needs a license code or a Patreon membership. Without one, write the MicroPython directly; it is exactly the same (switch the right panel to "MicroPython").
No library: under the yellow "set up" put Pybricks' own color sensor block (ColorSensor), pick the port the camera is on, and name it cam.
- In Pybricks Code press "+" to add a file and choose blocks.
- From "Sensors" drag the color sensor setup block (sensor icon) under "set up", rename it
cam(any English name works) and pick the port above. - 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). The program has no mode setting, but how you split the numbers depends on it.