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 (ESP32CAM) School edition × LEGO SPIKE App

Read the SharpShot Vision with the LEGO SPIKE App in three steps

In the LEGO SPIKE App, the SharpShot shows up as a Color Sensor. So you do not import a library: you read it with the Color Sensor blocks. "color" is the hue, "reflected light" is the motion value, and "raw red / green / blue" are the blob X, Y and area. Follow the steps on the left, and the blocks on the right grow with you. These block pictures were built and exported straight from the LEGO web app (spike.legoeducation.com), so they look the same as in your app.

1

Start: when program starts + forever

You read a sensor again and again. First put the yellow "when program starts", attach "forever" under it, and put "wait 0.1 seconds" inside, so it reads every 0.1 s.

  1. Open the LEGO SPIKE App, start a new project and choose "Word Blocks".
  2. From "Events", drag out "when program starts". From "Control", drag "forever" and attach it underneath.
  3. Drag a "wait 1 seconds" block into forever and change the number to 0.1.
2

Meet the five reading blocks, pick the right port

The LEGO app reads the SharpShot with five Color Sensor blocks. Each block starts with a port drop-down: pick the port the SharpShot is plugged into. You can use the numbers as they are; no maths needed:

Which port is the SharpShot on?
LEGO blockWhat you getRange
color (in Sensors)Hue (the colour at the sample point)-1, 0 ~ 100: red 0 (100 is also red), yellow about 17, green about 33, cyan about 50, blue about 67, magenta about 83; -1 = black, white or grey
reflected light (in Sensors)Motion value (how much the picture changed)0 ~ 100
raw red (in the "More Sensors" extension)Blob X (left / right)left 0 ~ right 98, centre about 50; 0 when not found
raw greenBlob Y (up / down)bottom 1 ~ top 75; 0 when not found
raw blueBlob area (how big)0 ~ 100, 0 = no blob found

To use raw red / green / blue, first press the extension button at the bottom left of the app and add "More Sensors". On Robot Inventor the color is only 0 ~ 10 (one tenth of the education app).

3

Store it in a variable and use it

In "Variables", make a new variable (for example "hue"). Use "set … to …" to store the reading in it; this gives the value a name. After that, use the variable to show or check the value. Click a function, and the blocks and the result change to its example.

Pretend sensor (what the camera sees): drag the blob and watch the result on the right

The pretend picture is only a guide: the numbers are simplified, and a real sensor can be a few steps off because of the light. Cross = sample point (the spot you picked on the sensor in "Setup 1: COLOR"); the color block reads the cross. Green box = the blob the sensor is tracking (the colour you picked in "Setup 2: TRACK").

Block examples for every function

Everything the LEGO app can read, each with a set of blocks you can copy (port C). Press "Try it" to jump to step 3.

What the LEGO app cannot read: the LEGO app only reads the sensor's "combined data", so it cannot read the SharpShot's saturation, brightness, blob width, blob height, sensor ID, firmware version or sensor connected. For saturation, brightness and blob width / height you can use the MBC SPIKE Blocks website; Pybricks can read every function (both need Pybricks firmware on the hub).

Good to know

  1. Use the "Color Sensor" group of sensor blocks in the LEGO app. To the LEGO app, the SharpShot is just a Color Sensor. You do not need to install anything.
  2. Do not use colour-picking blocks like "is color [red]?". They compare LEGO's own colour codes, not the SharpShot's hue. Always store "color" in a variable and compare numbers.
  3. You set the colours on the sensor: "color" looks at the sample point from "Setup 1: COLOR"; raw red / green / blue look at the blob from "Setup 2: TRACK". You can only set them with the buttons on the sensor. If you have not done Setup 1, color is always 0, the same as red.
  4. Check that a blob is found first. raw blue (area) = 0 means no blob is found. Then X and Y are also 0, which looks like the bottom-left corner. The area here is 0 ~ 100; this is a different unit from area() in Pybricks (width × height, 0 ~ 7500).
  5. Which way is which: stand behind the robot and look forward. X: left 0, right 98, centre about 50 (X − 50 is negative on the left, positive on the right). Y is small at the bottom and big at the top (bottom 1, top 75). The motion value is only right when the robot is still.