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

Below is a list of available blocks:
Object Sensor reflectivity – Reports the amount of light reflected from the object.
Object Sensor detects object – Reports whether the Object Sensor is detecting an object.
set Object Sensor detection threshold – Sets the amount of reflected light needed before an object is considered to be detected.
when Object Sensor – Runs the attached stack of blocks when the Object Sensor detects or loses an object.
Object Sensor reflectivity#
The Object Sensor reflectivity reporter block reports 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] reflectivity in %)
Parameter |
Description |
|---|---|
device |
Which Object Sensor to use, configured in the Devices window. |
Object Sensor detects object#
The Object Sensor detects object Boolean block reports 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, configured in the Devices window. |
set Object Sensor detection threshold#
The set Object Sensor detection threshold stack 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, configured in the Devices window. |
detection threshold |
The amount of reflected light needed to consider an object to be detected as a whole number. |
when Object Sensor#
The when Object Sensor hat 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 runs blocks when an undetected object is now detected. lost runs when a detected object is now no longer detected. |