Distance#

Introduction#

The Distance Sensor allows your robot to detect the presence of an object and measure its distance.

Below is a list of available blocks:

Distance found object?#

The Distance found object? block returns a Boolean indicating whether the Distance Sensor has detected an object within 2000 mm.

  • True – The Distance Sensor has detected an object.

  • False – The Distance Sensor has not detected an object.

<[FrontDistance v] Encontraste un objeto?>

Parameters

Description

distance sensor

Which Distance Sensor to use.

Example

cuando empezó :: hat events
[Spin until the Distance Sensor detects an object.]
turno [derecha v]
esperar hasta <[FrontDistance v] Encontraste un objeto?>
deja de conducir

object distance#

The object distance returns the distance of the nearest object from the Distance Sensor.

([FrontDistance v] distancia en [mm v])

Parameters

Description

distance sensor

Which Distance Sensor to use.

unit

The unit of measurement, which can be one of the following:

  • mm (millimeters)
  • inches

Example

cuando empezó :: hat events
[Don't print the message until the Distance Sensor detects an object.]
turno [derecha v]
esperar hasta <[FrontDistance v] Encontraste un objeto?>
deja de conducir
imprimir ([FrontDistance v] distancia en [mm v]) ▶