Distance Sensor#

Introduction#

The V5 Distance Sensor measures the distance to an object, its approximate size, and its approach speed. It operates over a range of 20 mm to 2,000 mm.

Below 200 mm, accuracy is approximately ±15 mm, and above 200 mm, accuracy improves to about 5%.

The Distance Sensor uses a Class 1 laser, ensuring detection is always directed straight ahead and is classroom-safe.

The VEX V5 Distance Sensor.

Below is a list of available Distance Sensor measurements:

object distance#

The object distance block returns the distance from the sensor to the nearest object.

([Distance 1 v] distancia del objeto en [mm v])

Parameters

Description

device

Which Distance Sensor to use, configured in the Devices window.

units

The unit of measurement:

  • mm – millimeters, from 20 to 2000.
  • inches – 0.78 to 78.74

Example

Drive forward until an object is detected within 200 mm#
cuando empezó
[Drive forward until the object is within 50 mm away.]
unidad [adelante v]
esperar hasta <([Distance 1 v] distancia del objeto en [mm v]) [math_less_than v] [50]>
deja de conducir

object velocity#

The object velocity block returns the relative speed of an object traveling toward or away from the Distance Sensor in m/s (meters per second).

([Distance 1 v] velocidad del objeto en m/s)

Parameters

Description

device

Which Distance Sensor to use, configured in the Devices window.

object size is?#

The object size is? block returns whether the detected object is of a certain size. The size is determined by how much of the Distance Sensor’s view is taken up by the detected object.

  • True – The Distance Sensor is detecting an object of the specified size.

  • False – The Distance Sensor is not detecting an object of the specified size.

<¿El tamaño del objeto [Distance 1 v] es [pequeño v]?>

Parameters

Description

device

Which Distance Sensor to use, configured in the Devices window.

size

The size of the object to look for:

  • small
  • medium
  • large

Distance Sensor found object?#

The Distance Sensor found object? block returns whether the Distance Sensor is detecting an object.

  • True – The Distance Sensor is detecting an object.

  • False – The Distance Sensor is not detecting an object.

<[Distance 1 v] Encontraste un objeto?>

Parameters

Description

device

Which Distance Sensor to use, configured in the Devices window.

Example

Drive forward until an object is detected within 50 mm#
cuando empezó
[Drive forward until the object is within 50 mm away.]
para siempre
unidad [adelante v]
si <[Distance 1 v] Encontraste un objeto?> entonces
si <([Distance 1 v] distancia del objeto en [mm v]) [math_less_than v] [50]> entonces
deja de conducir
romper