Import the library
The first thing in the program tells Pybricks "I want to use the WRO edition library". Without this line the hub does not know what MBC_HUE12 means, and you get a NameError.
Pick one library (both work the same; only the import line is different):
- Download the library (save the file and keep its name): MBC_hue12.py (only this sensor) or MBC_sensors.py (the all-in-one library). You picked
MBC_hue12.py. - In Pybricks Code, press "Import a file" in the file panel on the left and import it into the same project.
- Do not rename the file, and do not put it in a sub-folder.
- Go back to the main program and type the lines below at the very top (marked ① in the program on the right).
The hub needs Pybricks firmware v4.0.0b5 or newer. Older firmware cannot read the WRO edition (all 12 points stay at 255).