Object Sensor#

Introduction#

The Object Sensor is an infrared (IR) proximity sensor that detects when an object is close by using reflected IR light.

The VEX Object Sensor.

Below is a list of available blocks:

Object Sensor reflectivity#

The Object Sensor reflectivity block returns the amount of light reflected from the object as a percent.

Note:

  • 0% reflectivity means the object is very dark. The sensor sees a raw value of 3000 or higher.

  • 100% reflectivity means the object is very bright. The sensor sees a raw value of 0.

([ObjectSensorA v] 反射率百分比)

Parameter

Description

device

Which Object Sensor to use.

Object Sensor detects object?#

The Object Sensor detects object? block returns whether the Object Sensor is detecting an object.

  • True – The Object Sensor is detecting an object.

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

<[ObjectSensorA v] detects object?>

Parameter

Description

device

Which Object Sensor to use.

set Object Sensor detection threshold#

The set Object Sensor detection threshold block sets the amount of reflected light needed as a percent before an object is considered to be detected.

set [ObjectSensorA v] detection threshold to [50] %

Parameter

Description

device

Which Object Sensor to use.

detection threshold

The amount of reflected light needed to consider an object to be detected.

when Object Sensor#

The when Object Sensor block runs the attached stack of blocks when the Object Sensor detects or loses an object.

when [ObjectSensorA v] object is [detected v] :: hat events

Parameters

Description

device

Which Object Sensor to use.

state

When the attached stack of blocks will run:

  • detected – An undetected object is now detected
  • lost – A detected object is now no longer detected