Legacy edition, no longer supported: SharpShot Vision units shipped before 2026-10 (School and WRO editions) are no longer supported; their guides and examples stay here for reference. To upgrade to the current SharpShot Vision, contact the distributor you bought it from and send it back: the firmware update is free, and the buyer pays shipping both ways. Looking for the current SharpShot Vision? →
MBC SharpShot Vision WRO edition (HUE12) × EV3 Pybricks

Read the SharpShot WRO edition on the EV3 with MicroPython in three steps

MicroPython on the EV3 always goes in this order. First import. Then create an object and give the sensor a name. Last, use that name to read values. First pick Pybricks v4 or EV3 MicroPython v2 above. Then follow the steps on the left, and the program on the right grows with you. Click the boxes in the simulated camera picture to change colours to see what the program prints.

Your software:
1

Import the library

The first thing your program does is tell Pybricks: "I want to use the SharpShot 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 way. Only the import line is different.

  1. 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.
  2. Open code.pybricks.com in Chrome. Follow the steps on the site to put the Pybricks firmware on the EV3 (the release version already includes the EV3 firmware).
  3. Press "Import a file" in the file list on the left. Import the library into the same project.
  4. Do not rename the file, and do not put it in a sub-folder.
  5. Go back to your main program. Write the lines below at the very top (marked ① in the program on the right).
2

Create an object: name your sensor

A robot can have several sensors, so you "create an object". It tells the program which port the sensor is on, and gives it a name. Every time you read a value, you use this name.

Which port is the sensor on?

Turn on multitasking?

The 1 in the program is the port number: EV3 1~4 = S1~S4. You can also write Port.S1, but then you also need from pybricks.parameters import Port.

3

Use a function

You always write "hue12.function_name()": the name, a dot, then the function. Click a function, and the program and output change to its example.

Simulated camera picture (12 points in a row): click a box to change its colour and watch the output on the right
Colour to paint (pick a colour, then click a box above):

This picture is only an illustration: each colour uses one sample number. Real hue and saturation change with the light and the object. You set the positions of the 12 points on the sensor; here they sit in a row so they are easy to see (point 1 is on the far left). The red frame = point 1, which the examples read. The number under each box is the hue the program reads.

An example for every function

Full examples


        

!


        

!


        

!

Good to know

  1. With Pybricks v4, always call update() first. get_slot() does not read the sensor by itself. It only takes the data update() saved. Without update(), all 12 points stay ('NONE', 255, 0). Call it once in every loop.
  2. Unplugging works differently in the two programs. Pybricks v4 with the MBC library: update() returns False and get_slot() gives the last data. The computer prints one warning line, and the program keeps running. Plug it back in and it works again by itself. To check the cable, use sensor_ok(). EV3 MicroPython v2 with Ev3devSensor: you get an OSError and the program stops. Plug the sensor back in and run the program again. Tick "Unplug the sensor" on the right to see both.
  3. Reading the colour code: 0 to 239 are colours (red is at both ends: 0–9 and 230–239), 240 to 245 white, 246 to 250 black, 255 = this point is not set (while the sensor is in its menu, all 12 points are 255). Library colour names: Red, Org orange, Yel yellow, Lim lime, Grn green, Mnt mint, Cyn cyan, Azr azure, Blu blue, Prp purple, Mag magenta, Pnk pink, Wht white, Blk black, NONE not set.
  4. The EV3 has only one mode here: all 12 points are in mode 0, so you never change mode and reading several points is not slower. This sensor has no ID data: device_id() and firmware_version() cannot be read (you get a ValueError). To check it is plugged in, look for Connected to ID: 95 printed when the object is created, or use Sensor.GetType in clev3r (it is 95).
  5. EV3 Classroom cannot read this sensor. Its sensor type 95 is not a LEGO type, so EV3 Classroom blocks cannot read it. The EV3 software (EV3-G) needs the MBC custom block first. Pybricks v4, EV3 MicroPython v2 and clev3r can read it directly.