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.

SharpShot Vision (ESP32CAM) × EV3 × clev3r

Interactive tutorialEV3

First time? Try the interactive tutorial in your browser first, then follow the steps below with your hub.

This page covers clev3r (EV3 BASIC) only: how to set it up for the SharpShot Vision (ESP32CAM) on MINDSTORMS EV3, how to read every value, the commands it supports and examples. Use the switcher above to change product, host or software.

Setup

What you need

  • Sensor: SharpShot Vision (ESP32CAM) (EV3 edition, RJ12 plug).
  • Brick: LEGO MINDSTORMS EV3.
  • Software: clev3r (a BASIC programming environment for the EV3, also called EV3 Basic). The version tested for this site is v1.7.1.0. Pick this if you already use clev3r.

Install the software

  1. Install clev3r (v1.7.1.0 recommended).
  2. To open an example: open the .bp file in clev3r → "Compile and download" → run it from the folder starting with MBC_ in the EV3 file browser.

Make the software see the sensor

No extension needed. On the EV3 the sensor emulates an original LEGO sensor (most products are an "Infrared Sensor"), with exactly the same modes as the official EV3 software: Proximity / Beacon / Remote, with the same ranges.

  • Read them with BASIC commands such as IR_PROXIMITY / IR_BEACON / IR_REMOTE. See the readings below.
  • clev3r can also read modes that EV3-G and Classroom cannot, so examples marked "Pybricks / EV3 MicroPython / clev3r only" run here too.
  • Some products come with MBC subroutines. They are already inside the example files.

Important

Do not switch modes in the middle of a program. Every time the EV3 switches a sensor mode it stalls (about 1 s). Pick one mode at the start and use it for the whole run.

Wiring

  1. Plug the sensor into EV3 port 1 with the cable (any of 1~4 works; use the same port in the program).
  2. Turn the EV3 on first, then plug in the sensor.
  3. Latch up, push the plug in gently.

Set the colour on the sensor first

All SharpShot settings are made on the colour screen and buttons on the back of the sensor; no computer needed:

  1. The sensor only starts when plugged into a hub that is already on (the screen first shows "LEGO Sync..."); once the camera image appears it is ready.
  2. Short-press the side button to open the settings menu; left / right to choose, OK to enter. In the menu, hold the side button for 1 s to clear that colour set.
  3. Colour settings and camera parameters (brightness, contrast, saturation, exposure, white balance, flip, mirror) are saved automatically and used at the next power-on.

Two EV3 firmwares

Firmware Shows up on the EV3 as Software that works
School teacher creative-contest edition (colour pick + blob tracking + motion) Infrared sensor EV3-G, EV3 Classroom, Pybricks, clev3r
WRO 2026 edition (HUE12, 12 colour spots) Third-party sensor (type 95) EV3-G (MBC My Blocks), clev3r, Pybricks; EV3 Classroom cannot read it

First test

  1. Open the .bp of example 1 on this page and press "Compile and download".
  2. Run it from the folder starting with MBC_ in the EV3 file browser.
  3. If the number on the EV3 screen changes with what is in front of the sensor, everything is connected.

FAQ

  • Cannot find the program on the EV3? Look in the EV3 file browser for the folder starting with MBC_.
  • The number never changes? Unplug the sensor and plug it back in (the EV3 must be on first).
  • The program hiccups now and then? It switches sensor modes. Use one mode only.

Reading values (School edition)

Code assumes port 1: Sensor.SetMode picks the mode, Sensor.ReadRawValue reads the n-th value.

hue hue

hue
Range Meaning
-1~100 hue of sample point S1, 0100 (hue ring 0240 scaled); −1 = black/white/grey (saturation < 10); 0 when S1 is not set
' clev3r (BASIC)
Sensor.SetMode(1, 0)
hue = Sensor.ReadRawValue(1, 0)
Sensor.SetMode(1, 1)
hue = Sensor.ReadRawValue(1, 0)
Sensor.SetMode(1, 2)
hue = Sensor.ReadRawValue(1, 0)
Sensor.SetMode(1, 3)
hue = Sensor.ReadRawValue(1, 0)
Sensor.SetMode(1, 5)
hue = Sensor.ReadRawValue(1, 0)

mode 0 · int8 · IR-PROX 1×int8; mode 1 · int8 · IR-SEEK [色相, 飽和, 明度, 動態, X, Y, W, H]; mode 2 · int8 · IR-REMOTE [色相, 飽和, 明度, 動態]; mode 3 · int16 · IR-REM-A 1×int16(#65 已修成正確符號延伸,−1 = 0xFFFF); mode 5 · int16 · IR-CAL [色相, 飽和] 2×int16 (locked mode: firmware and hosts will not change it)

saturation saturation

saturation
Range Meaning
0~100 saturation of sample point S1, 0~100
' clev3r (BASIC)
Sensor.SetMode(1, 1)
saturation = Sensor.ReadRawValue(1, 1)
Sensor.SetMode(1, 2)
saturation = Sensor.ReadRawValue(1, 1)
Sensor.SetMode(1, 5)
saturation = Sensor.ReadRawValue(1, 1)

mode 1 · int8; mode 2 · int8; mode 5 · int16 (locked mode: firmware and hosts will not change it)

brightness value

brightness
Range Meaning
0~100 brightness (HSV value) of sample point S1, 0~100
' clev3r (BASIC)
Sensor.SetMode(1, 1)
value = Sensor.ReadRawValue(1, 2)
Sensor.SetMode(1, 2)
value = Sensor.ReadRawValue(1, 2)

mode 1 · int8; mode 2 · int8 (locked mode: firmware and hosts will not change it)

motion motion

motion
Range Meaning
0~100 whole-frame motion 0~100 (more change = larger)
' clev3r (BASIC)
Sensor.SetMode(1, 1)
motion = Sensor.ReadRawValue(1, 3)
Sensor.SetMode(1, 2)
motion = Sensor.ReadRawValue(1, 3)

mode 1 · int8; mode 2 · int8 (locked mode: firmware and hosts will not change it)

blob X blobX

blob X
Range Meaning
0~100 blob centre X 0~100, left = 0; 0 when not found
' clev3r (BASIC)
Sensor.SetMode(1, 1)
blobX = Sensor.ReadRawValue(1, 4)
Sensor.SetMode(1, 4)
blobX = Sensor.ReadRawValue(1, 0)

mode 1 · int8; mode 4 · int8 · IR-S-ALT [X, Y, W, H] (locked mode: firmware and hosts will not change it)

blob Y blobY

blob Y
Range Meaning
0~75 blob centre Y 0~75, bottom = 0, top = 75; 0 when not found
' clev3r (BASIC)
Sensor.SetMode(1, 1)
blobY = Sensor.ReadRawValue(1, 5)
Sensor.SetMode(1, 4)
blobY = Sensor.ReadRawValue(1, 1)

mode 1 · int8; mode 4 · int8 (locked mode: firmware and hosts will not change it)

blob width blobW

blob width
Range Meaning
0~100 blob width W 0~100; 0 = not found
' clev3r (BASIC)
Sensor.SetMode(1, 1)
blobW = Sensor.ReadRawValue(1, 6)
Sensor.SetMode(1, 4)
blobW = Sensor.ReadRawValue(1, 2)

mode 1 · int8; mode 4 · int8 (locked mode: firmware and hosts will not change it)

blob height blobH

blob height
Range Meaning
0~75 blob height H 0~75; 0 when not found
' clev3r (BASIC)
Sensor.SetMode(1, 1)
blobH = Sensor.ReadRawValue(1, 7)
Sensor.SetMode(1, 4)
blobH = Sensor.ReadRawValue(1, 3)

mode 1 · int8; mode 4 · int8 (locked mode: firmware and hosts will not change it)

Not readable here:blob area, blob found. Use Arduino / mBlock / micro:bit for these.

Reading values (WRO edition)

Code assumes port 1: Sensor.SetMode picks the mode, Sensor.ReadRawValue reads the n-th value.

spot 1~12 colour code spotColor

spot 1~12 colour code
Range Meaning
0~255 101B = colour code of spots S1S12: 0239 colour (hue 0255 scaled to 0239), 240245 white (saturation < 30, lower = larger), 246~250 black (value < 30, darker = larger), 255 = spot not enabled
' clev3r (BASIC)
Sensor.SetMode(1, 0)
spotColor1 = Sensor.ReadRawValue(1, 0)   ' first; for the N-th use 0 + N - 1

mode 0 · int32×8 · HUE12 8×int32 LE(32 B):24 byte = [色相, 鮮豔度]×12,每 3 byte 塞一個 int32(byte3 = 0);格 n 色相 = byte 2(n−1) → int32 k = idx/3、byte = idx%3;鎖住 (locked mode: firmware and hosts will not change it)

spot 1~12 vividness spotVivid

spot 1~12 vividness
Range Meaning
0~255 202B = vividness (saturation) of spots S1S12, 0~255: black = 1, white/colour = actual saturation; 0 when the spot is not enabled
' clev3r (BASIC)
Sensor.SetMode(1, 0)
spotVivid1 = Sensor.ReadRawValue(1, 0)   ' first; for the N-th use 0 + N - 1

mode 0 · int32×8 · 同 10~1B:格 n 鮮豔度 = byte 2(n−1)+1;鎖住 (locked mode: firmware and hosts will not change it)

Examples (School edition)

Example 1: What does the camera see? All 8 numbers at once

What this example does: Mode 1 sends 8 numbers at once: colour, saturation, brightness, motion, and the X, Y, width and height of the colour blob. Show them all on the EV3 screen and compare with the camera picture to understand each one.

What you need:

  • SharpShot (school edition) (EV3 edition)
  • EV3 brick

How to connect: SharpShot (school edition) in port 1. Camera setup: short-press the side button for the menu → left/right to "2:TRACK" → confirm → aim the crosshair at the ball, set the position, tolerance and minimum area in turn → confirm to save.

Download the program (pick your software):

⬇ clev3r

clev3r code
' ============================================================
' 神攝手 ESP32CAM 視覺感應器(學校老師創意賽版) EV3 新手範例 01:相機看到了什麼?8 個數字一次看
' 軟體:clev3r
' 接法:神攝手(學校版)插 1 號孔;左輪馬達接 B、右輪馬達接 C
' 這個範例會做什麼:模式 1 一次送出 8 個數字:顏色、鮮豔度、亮度、動態、色塊的 X、Y、寬、高。全部顯示在 EV3 螢幕上,對照相機畫面就能看懂每個數字的意思。
' 讀值:hue1=顏色(色相)(0 ~ 100,-1=黑白灰);sta=顏色鮮豔度(0 ~ 100);val=亮度(0 ~ 100);motion=畫面動了多少(0 ~ 100);x=色塊左右位置(0 ~ 100(左 → 右),沒找到=0);y=色塊上下位置(0 ~ 75(下 → 上),沒找到=0);w=色塊寬度(0 ~ 100,0=沒找到);h=色塊高度(越近越大)(0 ~ 75,0=沒找到)
' ============================================================
folder "prjs" "MBC_esp32cam_ex01"

' 神攝手(學校版)插 1 號孔,使用模式 1
Sensor.SetMode(1, 1)
LCD.Clear()

' 清除螢幕
LCD.Clear()
' 一直重複
While "True"
  ' 顏色:紅 0 或 100、黃約 17、綠約 33、藍約 67,-1=黑白灰
  LCD.Text(1, 0, 0, 1, "HUE " + Sensor.ReadRawValue(1, 0) + "      ")
  ' 鮮豔度 0~100
  LCD.Text(1, 0, 16, 1, "STA " + Sensor.ReadRawValue(1, 1) + "      ")
  ' 亮度 0~100
  LCD.Text(1, 0, 32, 1, "VAL " + Sensor.ReadRawValue(1, 2) + "      ")
  ' 畫面動了多少 0~100
  LCD.Text(1, 0, 48, 1, "MOTION " + Sensor.ReadRawValue(1, 3) + "      ")
  ' 色塊左右位置 0~100
  LCD.Text(1, 0, 64, 1, "X " + Sensor.ReadRawValue(1, 4) + "      ")
  ' 色塊上下位置 0~75
  LCD.Text(1, 0, 80, 1, "Y " + Sensor.ReadRawValue(1, 5) + "      ")
  ' 色塊寬度,0=沒找到
  LCD.Text(1, 0, 96, 1, "W " + Sensor.ReadRawValue(1, 6) + "      ")
  ' 色塊高度,越近越大
  LCD.Text(1, 0, 112, 1, "H " + Sensor.ReadRawValue(1, 7) + "      ")
  ' 等 0.1 秒
  Program.Delay(100)
EndWhile

Step by step:

  1. Clear the screen
  2. Repeat forever
    • Colour: red 0 or 100, yellow ≈17, green ≈33, blue ≈67, -1 = black/white/grey
    • Saturation 0~100
    • Brightness 0~100
    • How much the picture moved 0~100
    • Blob horizontal position 0~100
    • Blob vertical position 0~75
    • Blob width, 0 = not found
    • Blob height, bigger when closer
    • Wait 0.1 s

What you should see: Move the ball left and right in front of the lens and X follows; bring it closer and W and H grow; take it away and X, Y, W, H all read 0.

FAQ:

  • The camera screen stays on "LEGO Sync..."? The camera only starts when plugged into an EV3 that is already on. Turn the EV3 on first, then plug in the camera.
  • X, Y, W, H always read 0? 2:TRACK has not been set up, or the ball colour is outside the tolerance.

Example 2: Traffic-light robot: go on green only

What this example does: Mode 0 reads only the "colour". Drive forward on green, stop on anything else (red).

What you need:

  • EV3 brick + Education base robot (left wheel on B, right wheel on C)
  • SharpShot (school edition) (EV3 edition)
  • One red and one green card

How to connect: SharpShot (school edition) in port 1, mounted at the front with the lens facing forward.Camera setup: short-press the side button for the menu → left/right to "1:COLOR" → confirm → aim the crosshair at the colour to learn, set the position and tolerance in turn → confirm to save.

Download the program (pick your software):

⬇ clev3r

clev3r code
' ============================================================
' 神攝手 ESP32CAM 視覺感應器(學校老師創意賽版) EV3 新手範例 02:紅綠燈車:看到綠色才走
' 軟體:clev3r
' 接法:神攝手(學校版)插 1 號孔;左輪馬達接 B、右輪馬達接 C
' 這個範例會做什麼:用模式 0 只讀「顏色」。看到綠色就往前開,其他顏色(紅色)就停。
' 讀值:hue=顏色(色相)(0 ~ 100(紅 0 或 100、黃約 17、綠約 33、藍約 67),-1=黑白灰)
' ============================================================
folder "prjs" "MBC_esp32cam_ex02"

' 神攝手(學校版)插 1 號孔,使用模式 0
Sensor.SetMode(1, 0)
LCD.Clear()

' 一直重複
While "True"
  ' 如果顏色在 25~45 之間(綠色)
  If (Sensor.ReadRawValue(1, 0) >= 25) And (Sensor.ReadRawValue(1, 0) <= 45) Then
    ' 是綠色:往前開
    Motor.StartPower("B", 30)
    Motor.StartPower("C", 30)
  Else
    ' 不是綠色:停車
    Motor.Stop("BC", "True")
  EndIf
EndWhile

Step by step:

  1. Repeat forever
    • If the colour is between 25 and 45 (green)
      • Green: drive forward
      • Otherwise:
        • Not green: stop

What you should see: Hold the green card in front of the lens and the robot drives; swap to the red card and it stops.

FAQ:

  • The camera screen stays on "LEGO Sync..."? The camera only starts when plugged into an EV3 that is already on. Turn the EV3 on first, then plug in the camera.
  • It does not go on green either? Run example 1 to see the real HUE of your green card, then change 25 and 45 in the program.

Example 3: Burglar alarm: beep when something moves

What this example does: The 4th number of mode 1 is "how much the picture moved". Point the camera at a doorway; when someone walks past the number jumps, and above 20 the EV3 beeps. No camera setup needed.

What you need:

  • SharpShot (school edition) (EV3 edition)
  • EV3 brick

How to connect: SharpShot (school edition) in port 1, lens pointing at the area to watch, held steady.

Download the program (pick your software):

⬇ clev3r

clev3r code
' ============================================================
' 神攝手 ESP32CAM 視覺感應器(學校老師創意賽版) EV3 新手範例 03:防盜警報:有東西動就叫
' 軟體:clev3r
' 接法:神攝手(學校版)插 1 號孔;左輪馬達接 B、右輪馬達接 C
' 這個範例會做什麼:模式 1 的第 4 個數字是「畫面動了多少」。相機對著門口,有人經過數字就會變大,超過 20 就嗶嗶叫。這個範例相機不用做任何設定。
' 讀值:motion=畫面動了多少(0 ~ 100)
' ============================================================
folder "prjs" "MBC_esp32cam_ex03"

' 神攝手(學校版)插 1 號孔,使用模式 1
Sensor.SetMode(1, 1)
LCD.Clear()

' 一直重複
While "True"
  ' 螢幕顯示動態值
  LCD.Text(1, 0, 0, 1, "MOTION " + Sensor.ReadRawValue(1, 3) + "      ")
  ' 如果動態值大於 20
  If Sensor.ReadRawValue(1, 3) > 20 Then
    ' 有東西在動:嗶!
    Speaker.Tone(50, 1000, 100)
    Speaker.Wait()
  EndIf
EndWhile

Step by step:

  1. Repeat forever
    • Show the motion value on screen
    • If the motion value is greater than 20
      • Something is moving: beep!

What you should see: Quiet when the picture is still; wave a hand in front of the lens and the EV3 beeps.

FAQ:

  • The camera screen stays on "LEGO Sync..."? The camera only starts when plugged into an EV3 that is already on. Turn the EV3 on first, then plug in the camera.
  • It beeps even when nobody is there? Flickering lights or a shaking camera. Raise 20 (for example 35).

Example 4: Turn to look at the ball

What this example does: The robot spins on the spot to keep the ball in the middle of the picture: ball on the left means turn left, on the right means turn right, in the middle means stop; no ball means spin to search.

What you need:

  • EV3 brick + Education base robot (left wheel on B, right wheel on C)
  • SharpShot (school edition) (EV3 edition)
  • A brightly coloured ball

How to connect: SharpShot (school edition) in port 1, mounted at the front with the lens facing forward.Camera setup: short-press the side button for the menu → left/right to "2:TRACK" → confirm → aim the crosshair at the ball, set the position, tolerance and minimum area in turn → confirm to save.

Download the program (pick your software):

⬇ clev3r

clev3r code
' ============================================================
' 神攝手 ESP32CAM 視覺感應器(學校老師創意賽版) EV3 新手範例 04:看球轉頭
' 軟體:clev3r
' 接法:神攝手(學校版)插 1 號孔;左輪馬達接 B、右輪馬達接 C
' 這個範例會做什麼:車子原地轉,讓球一直保持在畫面中間:球在左邊就往左轉、在右邊就往右轉、在中間就停;看不到球就原地轉圈找。
' 讀值:w=色塊寬度(0 ~ 100,0=沒找到);x=色塊左右位置(0 ~ 100(左 → 右),沒找到=0)
' ============================================================
folder "prjs" "MBC_esp32cam_ex04"

' 神攝手(學校版)插 1 號孔,使用模式 1
Sensor.SetMode(1, 1)
LCD.Clear()

' 一直重複
While "True"
  ' 如果色塊寬度=0(沒找到球)
  If Sensor.ReadRawValue(1, 6) = 0 Then
    ' 看不到球(寬度=0):原地慢慢轉圈找
    Motor.StartPower("B", 15)
    Motor.StartPower("C", -15)
  ' 如果 X 小於 40(左邊)
  ElseIf Sensor.ReadRawValue(1, 4) < 40 Then
    ' 球在左邊:往左轉
    Motor.StartPower("B", -15)
    Motor.StartPower("C", 15)
  ' 否則,如果 X 大於 60(右邊)
  ElseIf Sensor.ReadRawValue(1, 4) > 60 Then
    ' 球在右邊:往右轉
    Motor.StartPower("B", 15)
    Motor.StartPower("C", -15)
  Else
    ' 球在中間:停住
    Motor.Stop("BC", "True")
  EndIf
EndWhile

Step by step:

  1. Repeat forever
    • If the blob width = 0 (ball not found)
      • Cannot see the ball (width = 0): spin slowly on the spot to look for it
      • Otherwise:
        • If X is less than 40 (left)
          • Ball on the left: turn left
          • Otherwise:
            • Otherwise, if X is greater than 60 (right)
              • Ball on the right: turn right
              • Otherwise:
                • Ball in the centre: stop

What you should see: Move the ball left and right in front of the robot and its nose follows the ball.

FAQ:

  • The camera screen stays on "LEGO Sync..."? The camera only starts when plugged into an EV3 that is already on. Turn the EV3 on first, then plug in the camera.
  • Left and right are swapped? Swap -15 and 15 in the two tank steps.

Example 5: Chase the ball: stop when close enough

What this example does: Example 4 made to drive: aim at the ball while driving forward, and stop when the ball height H is big enough (close enough).

What you need:

  • EV3 brick + Education base robot (left wheel on B, right wheel on C)
  • SharpShot (school edition) (EV3 edition)
  • A brightly coloured ball

How to connect: SharpShot (school edition) in port 1, mounted at the front with the lens facing forward.Camera setup: short-press the side button for the menu → left/right to "2:TRACK" → confirm → aim the crosshair at the ball, set the position, tolerance and minimum area in turn → confirm to save.

Download the program (pick your software):

⬇ clev3r

clev3r code
' ============================================================
' 神攝手 ESP32CAM 視覺感應器(學校老師創意賽版) EV3 新手範例 05:追球:靠近到一定距離就停
' 軟體:clev3r
' 接法:神攝手(學校版)插 1 號孔;左輪馬達接 B、右輪馬達接 C
' 這個範例會做什麼:把範例 4 改成會往前開:一邊對準球一邊前進,球的高度 H 夠大(夠近)就停下來。
' 讀值:w=色塊寬度(0 ~ 100,0=沒找到);h=色塊高度(越近越大)(0 ~ 75,0=沒找到);x=色塊左右位置(0 ~ 100(左 → 右),沒找到=0)
' ============================================================
folder "prjs" "MBC_esp32cam_ex05"

' 神攝手(學校版)插 1 號孔,使用模式 1
Sensor.SetMode(1, 1)
LCD.Clear()

' 一直重複
While "True"
  ' 如果寬度=0(沒找到球)
  If Sensor.ReadRawValue(1, 6) = 0 Then
    ' 看不到球:原地轉圈找
    Motor.StartPower("B", 15)
    Motor.StartPower("C", -15)
  ' 否則,如果 H 大於 30
  ElseIf Sensor.ReadRawValue(1, 7) > 30 Then
    ' 球的高度大於 30(夠近了):停車
    Motor.Stop("BC", "True")
  Else
    ' 轉彎力量 turn =(X − 50)× 0.6:球偏右是正數
    turn = (Sensor.ReadRawValue(1, 4) - 50) * 0.6
    ' 左輪=25+turn、右輪=25-turn:邊對準邊前進
    Motor.StartPower("B", 25 + turn)
    Motor.StartPower("C", 25 - turn)
  EndIf
EndWhile

Step by step:

  1. Repeat forever
    • If width = 0 (ball not found)
      • Cannot see the ball: spin on the spot to look for it
      • Otherwise:
        • Otherwise, if H is greater than 30
          • Ball height greater than 30 (close enough): stop
          • Otherwise:
            • Steering power turn = (X − 50) × 0.6: positive when the ball is to the right
            • Left wheel = 25 + turn, right wheel = 25 − turn: aim at the ball while driving forward

What you should see: Put the ball on the floor: the robot turns to it, drives over and stops in front of it.

FAQ:

  • The camera screen stays on "LEGO Sync..."? The camera only starts when plugged into an EV3 that is already on. Turn the EV3 on first, then plug in the camera.
  • It stops while still far away? Raise 30.

Still stuck? Leave a message on Contact us with the software you use and a screenshot of your program, and we will help.

Examples (WRO edition)

Example 1: What colour does spot S1 see?

What this example does: The WRO edition has 12 colour spots; each reports "the colour at that position right now". Set up S1 and show its colour code and saturation on the screen.

What you need:

  • SharpShot (WRO edition) (EV3 edition)
  • EV3 brick
  • Bricks of various colours

How to connect: SharpShot (WRO edition) in port 1, mounted at the front with the lens facing forward. Camera setup: short-press the side button for the menu → left/right to S1 → confirm → move the crosshair to the spot to watch (X, Y) → set the tolerance → confirm to save.

Download the program (pick your software):

⬇ clev3r

clev3r code
' ============================================================
' 神攝手 ESP32CAM 視覺感應器(WRO 2026 版 HUE12) EV3 新手範例 01:色點 S1 看到什麼顏色?
' 軟體:clev3r
' 接法:神攝手(WRO 版)插 1 號孔;左輪馬達接 B、右輪馬達接 C
' 這個範例會做什麼:WRO 版有 12 個色點,每個色點回報「那一個位置現在的顏色」。先設定 S1,把它的顏色碼和鮮豔度顯示在螢幕上。
' 讀值:hue1=色點 S1 的顏色碼(0 ~ 239 彩色(紅 0/239、黃 40、綠 80、青 120、藍 160、紫 200);240~245 白;246~250 黑;255=色點沒開);sta1=色點 S1 的鮮豔度(0 ~ 255(黑色固定 1))
' ============================================================
folder "prjs" "MBC_esp32cam_wro_ex01"

' 神攝手(WRO 版)插 1 號孔,使用模式 0
Sensor.SetMode(1, 0)
LCD.Clear()

' 清除螢幕
LCD.Clear()
' 一直重複
While "True"
  ' 第 1 行:S1 的顏色碼
  LCD.Text(1, 0, 0, 1, "S1 " + Math.Remainder(Sensor.ReadRawValue(1, 0), 256) + "      ")
  ' 第 2 行:S1 的鮮豔度
  LCD.Text(1, 0, 16, 1, "T1 " + Math.Remainder(Math.Floor(Sensor.ReadRawValue(1, 0) / 256), 256) + "      ")
  ' 等 0.1 秒
  Program.Delay(100)
EndWhile

Step by step:

  1. Clear the screen
  2. Repeat forever
    • Row 1: colour code of S1
    • Row 2: saturation of S1
    • Wait 0.1 s

What you should see: Put bricks of different colours at the S1 position and the colour code changes: red ≈0, yellow ≈40, green ≈80, blue ≈160.

FAQ:

  • The camera screen stays on "LEGO Sync..."? The camera only starts when plugged into an EV3 that is already on. Turn the EV3 on first, then plug in the camera.
  • The number is always 255? That colour spot is not set up (not enabled). Set up S1 as described above.
  • What do the colour numbers mean? 0239 are colours: red 0 (or 239), yellow 40, green 80, cyan 120, blue 160, purple 200; 240245 white; 246~250 black.
  • The camera picture is upside down? Turn V-Flip on in the menu. After changing the orientation, set up the colour spots again.
  • Flashed the school edition first, now the WRO edition spots act strangely? Both editions store settings in the same place: do a Reset Default in the menu first, then set up the spots again.

Example 2: Colour announcer: show the colour name on screen

What this example does: Split the colour code into ranges to decide red, green, blue, white or black, show the English name on the screen and beep.

What you need:

  • SharpShot (WRO edition) (EV3 edition)
  • EV3 brick
  • Red, green and blue bricks

How to connect: SharpShot (WRO edition) in port 1, mounted at the front with the lens facing forward. Camera setup: short-press the side button for the menu → left/right to S1 → confirm → move the crosshair to the spot to watch (X, Y) → set the tolerance → confirm to save.

Download the program (pick your software):

⬇ clev3r

clev3r code
' ============================================================
' 神攝手 ESP32CAM 視覺感應器(WRO 2026 版 HUE12) EV3 新手範例 02:顏色播報:螢幕顯示顏色名稱
' 軟體:clev3r
' 接法:神攝手(WRO 版)插 1 號孔;左輪馬達接 B、右輪馬達接 C
' 這個範例會做什麼:把顏色碼分成幾段,判斷是紅、綠、藍、白、黑,在螢幕上顯示英文名稱並嗶一聲。
' 讀值:hue1=色點 S1 的顏色碼(0 ~ 239 彩色(紅 0/239、黃 40、綠 80、青 120、藍 160、紫 200);240~245 白;246~250 黑;255=色點沒開)
' ============================================================
folder "prjs" "MBC_esp32cam_wro_ex02"

' 神攝手(WRO 版)插 1 號孔,使用模式 0
Sensor.SetMode(1, 0)
LCD.Clear()

' 一直重複
While "True"
  ' 把 S1 的顏色碼存進 hue
  hue = Math.Remainder(Sensor.ReadRawValue(1, 0), 256)
  ' 清除螢幕
  LCD.Clear()
  ' 如果是紅色
  If (hue < 15) Or ((hue > 225) And (hue < 240)) Then
    ' 0~14 或 226~239:紅色
    LCD.Text(1, 0, 0, 1, "RED      ")
  ' 否則,如果是綠色
  ElseIf (hue >= 60) And (hue <= 100) Then
    ' 60~100:綠色
    LCD.Text(1, 0, 0, 1, "GREEN      ")
  ' 否則,如果是藍色
  ElseIf (hue >= 140) And (hue <= 180) Then
    ' 140~180:藍色
    LCD.Text(1, 0, 0, 1, "BLUE      ")
  ' 否則,如果是白色
  ElseIf (hue >= 240) And (hue <= 245) Then
    ' 240~245:白色
    LCD.Text(1, 0, 0, 1, "WHITE      ")
  ' 否則,如果是黑色
  ElseIf (hue >= 246) And (hue <= 250) Then
    ' 246~250:黑色
    LCD.Text(1, 0, 0, 1, "BLACK      ")
  Else
    ' 其他顏色
    LCD.Text(1, 0, 0, 1, "OTHER      ")
  EndIf
  ' 等 0.3 秒
  Program.Delay(300)
EndWhile

Step by step:

  1. Repeat forever
    • Store the colour code of S1 in hue
    • Clear the screen
    • If it is red
      • 014 or 226239: red
      • Otherwise:
        • Otherwise, if it is green
          • 60~100: green
          • Otherwise:
            • Otherwise, if it is blue
              • 140~180: blue
              • Otherwise:
                • Otherwise, if it is white
                  • 240~245: white
                  • Otherwise:
                    • Otherwise, if it is black
                      • 246~250: black
                      • Otherwise:
                        • Any other colour
    • Wait 0.3 s

What you should see: Put red, green and blue bricks at the S1 position and the screen shows RED, GREEN, BLUE.

FAQ:

  • The camera screen stays on "LEGO Sync..."? The camera only starts when plugged into an EV3 that is already on. Turn the EV3 on first, then plug in the camera.
  • The number is always 255? That colour spot is not set up (not enabled). Set up S1 as described above.
  • What do the colour numbers mean? 0239 are colours: red 0 (or 239), yellow 40, green 80, cyan 120, blue 160, purple 200; 240245 white; 246~250 black.
  • The camera picture is upside down? Turn V-Flip on in the menu. After changing the orientation, set up the colour spots again.
  • Flashed the school edition first, now the WRO edition spots act strangely? Both editions store settings in the same place: do a Reset Default in the menu first, then set up the spots again.

Example 3: Traffic pillar: stop on red, go on green

What this example does: The red/green pillars common in WRO Future Engineers: S1 looks ahead, stop on red, drive forward on green.

What you need:

  • EV3 brick + Education base robot (left wheel on B, right wheel on C)
  • SharpShot (WRO edition) (EV3 edition)
  • Red and green pillars or bricks

How to connect: SharpShot (WRO edition) in port 1, mounted at the front with the lens facing forward. Camera setup: short-press the side button for the menu → left/right to S1 → confirm → move the crosshair to the spot to watch (X, Y) → set the tolerance → confirm to save.

Download the program (pick your software):

⬇ clev3r

clev3r code
' ============================================================
' 神攝手 ESP32CAM 視覺感應器(WRO 2026 版 HUE12) EV3 新手範例 03:交通號誌柱:紅停綠走
' 軟體:clev3r
' 接法:神攝手(WRO 版)插 1 號孔;左輪馬達接 B、右輪馬達接 C
' 這個範例會做什麼:WRO 未來工程師常見的紅綠柱子:S1 對準前方,看到紅色就停車、看到綠色就往前開。
' 讀值:hue1=色點 S1 的顏色碼(0 ~ 239 彩色(紅 0/239、黃 40、綠 80、青 120、藍 160、紫 200);240~245 白;246~250 黑;255=色點沒開)
' ============================================================
folder "prjs" "MBC_esp32cam_wro_ex03"

' 神攝手(WRO 版)插 1 號孔,使用模式 0
Sensor.SetMode(1, 0)
LCD.Clear()

' 一直重複
While "True"
  ' 把 S1 的顏色碼存進 hue
  hue = Math.Remainder(Sensor.ReadRawValue(1, 0), 256)
  ' 如果是綠色(60~100)
  If (hue >= 60) And (hue <= 100) Then
    ' 綠色:往前開
    Motor.StartPower("B", 30)
    Motor.StartPower("C", 30)
  ' 否則,如果是紅色
  ElseIf (hue < 15) Or ((hue > 225) And (hue < 240)) Then
    ' 紅色:停車
    Motor.Stop("BC", "True")
  EndIf
EndWhile

Step by step:

  1. Repeat forever
    • Store the colour code of S1 in hue
    • If it is green (60~100)
      • Green: drive forward
      • Otherwise:
        • Otherwise, if it is red
          • Red: stop

What you should see: Put a green pillar ahead and the robot drives; swap to red and it stops. Other colours keep the current action.

FAQ:

  • The camera screen stays on "LEGO Sync..."? The camera only starts when plugged into an EV3 that is already on. Turn the EV3 on first, then plug in the camera.
  • The number is always 255? That colour spot is not set up (not enabled). Set up S1 as described above.
  • What do the colour numbers mean? 0239 are colours: red 0 (or 239), yellow 40, green 80, cyan 120, blue 160, purple 200; 240245 white; 246~250 black.
  • The camera picture is upside down? Turn V-Flip on in the menu. After changing the orientation, set up the colour spots again.
  • Flashed the school edition first, now the WRO edition spots act strangely? Both editions store settings in the same place: do a Reset Default in the menu first, then set up the spots again.

Example 4: Stop at the black line

What this example does: Set S1 at the bottom of the picture looking at the floor; the robot drives forward and stops when S1 sees black (246~250).

What you need:

  • EV3 brick + Education base robot (left wheel on B, right wheel on C)
  • SharpShot (WRO edition) (EV3 edition)
  • A strip of black tape on a white floor

How to connect: SharpShot (WRO edition) in port 1, mounted at the front with the lens facing forward. Camera setup: short-press the side button for the menu → left/right to S1 → confirm → move the crosshair to the bottom of the picture (looking at the floor) → set the tolerance → confirm to save.

Download the program (pick your software):

⬇ clev3r

clev3r code
' ============================================================
' 神攝手 ESP32CAM 視覺感應器(WRO 2026 版 HUE12) EV3 新手範例 04:看到黑線就停車
' 軟體:clev3r
' 接法:神攝手(WRO 版)插 1 號孔;左輪馬達接 B、右輪馬達接 C
' 這個範例會做什麼:把 S1 設在畫面下方對著地面,車子往前開,S1 看到黑色(246~250)就停。
' 讀值:hue1=色點 S1 的顏色碼(0 ~ 239 彩色(紅 0/239、黃 40、綠 80、青 120、藍 160、紫 200);240~245 白;246~250 黑;255=色點沒開)
' ============================================================
folder "prjs" "MBC_esp32cam_wro_ex04"

' 神攝手(WRO 版)插 1 號孔,使用模式 0
Sensor.SetMode(1, 0)
LCD.Clear()

' 往前開
Motor.StartPower("B", 25)
Motor.StartPower("C", 25)
' 等到 S1 的顏色碼在 246~250(黑色)
While (Math.Remainder(Sensor.ReadRawValue(1, 0), 256) < 246) Or (Math.Remainder(Sensor.ReadRawValue(1, 0), 256) > 250)
  Program.Delay(10)
EndWhile
' 停車
Motor.Stop("BC", "True")
' 嗶一聲
Speaker.Tone(50, 1000, 100)
Speaker.Wait()

Step by step:

  1. Drive forward
  2. Wait until the colour code of S1 is 246~250 (black)
  3. Stop
  4. Beep

What you should see: The robot drives forward and stops with a beep when it reaches the black line.

FAQ:

  • The camera screen stays on "LEGO Sync..."? The camera only starts when plugged into an EV3 that is already on. Turn the EV3 on first, then plug in the camera.
  • The number is always 255? That colour spot is not set up (not enabled). Set up S1 as described above.
  • What do the colour numbers mean? 0239 are colours: red 0 (or 239), yellow 40, green 80, cyan 120, blue 160, purple 200; 240245 white; 246~250 black.
  • The camera picture is upside down? Turn V-Flip on in the menu. After changing the orientation, set up the colour spots again.
  • Flashed the school edition first, now the WRO edition spots act strangely? Both editions store settings in the same place: do a Reset Default in the menu first, then set up the spots again.

Example 5: Three spots left, middle, right: where is the red?

What this example does: Set up S1, S2, S3 as left, middle, right. Whichever spot sees red, the robot turns that way; no red means stop.

What you need:

  • EV3 brick + Education base robot (left wheel on B, right wheel on C)
  • SharpShot (WRO edition) (EV3 edition)
  • A red brick

How to connect: SharpShot (WRO edition) in port 1, mounted at the front with the lens facing forward. Camera setup: put S1 on the left of the picture, S2 in the middle and S3 on the right, all three at the same height.

Download the program (pick your software):

⬇ clev3r

clev3r code
' ============================================================
' 神攝手 ESP32CAM 視覺感應器(WRO 2026 版 HUE12) EV3 新手範例 05:左中右三個色點:紅色在哪邊?
' 軟體:clev3r
' 接法:神攝手(WRO 版)插 1 號孔;左輪馬達接 B、右輪馬達接 C
' 這個範例會做什麼:設定 S1(左)、S2(中)、S3(右)三個色點,看紅色出現在哪一個,車子就往那邊轉。
' 讀值:hue1=色點 S1 的顏色碼(0 ~ 239 彩色(紅 0/239、黃 40、綠 80、青 120、藍 160、紫 200);240~245 白;246~250 黑;255=色點沒開);hue3=色點 S3 的顏色碼(0 ~ 239 彩色(紅 0/239、黃 40、綠 80、青 120、藍 160、紫 200);240~245 白;246~250 黑;255=色點沒開);hue2=色點 S2 的顏色碼(0 ~ 239 彩色(紅 0/239、黃 40、綠 80、青 120、藍 160、紫 200);240~245 白;246~250 黑;255=色點沒開)
' ============================================================
folder "prjs" "MBC_esp32cam_wro_ex05"

' 神攝手(WRO 版)插 1 號孔,使用模式 0
Sensor.SetMode(1, 0)
LCD.Clear()

' 一直重複
While "True"
  ' 如果 S1 是紅色
  If (Math.Remainder(Sensor.ReadRawValue(1, 0), 256) < 15) Or ((Math.Remainder(Sensor.ReadRawValue(1, 0), 256) > 225) And (Math.Remainder(Sensor.ReadRawValue(1, 0), 256) < 240)) Then
    ' 紅色在左邊(S1):往左轉
    Motor.StartPower("B", -15)
    Motor.StartPower("C", 15)
  ' 否則,如果 S3 是紅色
  ElseIf (Math.Remainder(Math.Floor(Sensor.ReadRawValue(1, 1) / 256), 256) < 15) Or ((Math.Remainder(Math.Floor(Sensor.ReadRawValue(1, 1) / 256), 256) > 225) And (Math.Remainder(Math.Floor(Sensor.ReadRawValue(1, 1) / 256), 256) < 240)) Then
    ' 紅色在右邊(S3):往右轉
    Motor.StartPower("B", 15)
    Motor.StartPower("C", -15)
  ' 否則,如果 S2 是紅色
  ElseIf (Math.Remainder(Math.Floor(Sensor.ReadRawValue(1, 0) / 65536), 256) < 15) Or ((Math.Remainder(Math.Floor(Sensor.ReadRawValue(1, 0) / 65536), 256) > 225) And (Math.Remainder(Math.Floor(Sensor.ReadRawValue(1, 0) / 65536), 256) < 240)) Then
    ' 紅色在中間(S2):往前開
    Motor.StartPower("B", 25)
    Motor.StartPower("C", 25)
  Else
    ' 沒看到紅色:停住
    Motor.Stop("BC", "True")
  EndIf
EndWhile

Step by step:

  1. Repeat forever
    • If S1 is red
      • Red on the left (S1): turn left
      • Otherwise:
        • Otherwise, if S3 is red
          • Red on the right (S3): turn right
          • Otherwise:
            • Otherwise, if S2 is red
              • Red in the middle (S2): drive forward
              • Otherwise:
                • No red seen: stop

What you should see: Move the red brick left, centre and right in front of the camera and the robot turns left, drives forward or turns right.

FAQ:

  • The camera screen stays on "LEGO Sync..."? The camera only starts when plugged into an EV3 that is already on. Turn the EV3 on first, then plug in the camera.
  • The number is always 255? That colour spot is not set up (not enabled). Set up S1 as described above.
  • What do the colour numbers mean? 0239 are colours: red 0 (or 239), yellow 40, green 80, cyan 120, blue 160, purple 200; 240245 white; 246~250 black.
  • The camera picture is upside down? Turn V-Flip on in the menu. After changing the orientation, set up the colour spots again.
  • Flashed the school edition first, now the WRO edition spots act strangely? Both editions store settings in the same place: do a Reset Default in the menu first, then set up the spots again.

Still stuck? Leave a message on Contact us with the software you use and a screenshot of your program, and we will help.

More questions

  • The EV3 shows an infrared sensor? Expected: the sensor emulates a LEGO sensor so the stock blocks can read it.
  • A short freeze when switching modes? The EV3 needs about 1 s per mode change. Stick to one mode during a run.

Still stuck? Contact us with your software and a screenshot of the program.

Downloads

Sources

  • Host and software list:_build/guides.json
  • Values and commands:_build/protocol/cam_school.json、_build/protocol/cam_wro.json (single source of truth)
  • Setup:_build/guides/software/ev3-clev3r.en.md、_build/guides/product/esp32cam/ev3-clev3r.en.md
  • Examples:sensors/esp32cam/ev3-examples(-wro).md
Email for a quoteBuying Guide