Import the library
The first thing in a block program is a red "from … import …" block under the yellow "set up". It tells Pybricks to use the Ranger 8-Way library.
Pick one library (the blocks are the same; only the name after "from" is different):
- Download the library (save the file and keep its name): MBC_laser8.py (only this sensor) or MBC_sensors.py (the all-in-one library). You picked
MBC_laser8.py. - In Pybricks Code, click "Import a file" in the file area on the left and import it into the same project. Do not rename the file.
- Click "+" to add a new file and choose blocks.
- Drag the red "from … import …" block from the block list, attach it under "set up", and pick the two names.