1. ranging sensor[index] distance to an object(cm)

Ranging Sensor - 图1

Reports the distance of the obstacle detected by the specified ranging sensor

How to Use

Ranging sensors detect the distance of obstacles through infrared waves.
Distance range: 2–200 cm
The number in this block indicates the place of a ranging sensor among the ones connected to Halocode. As shown in the following figure, the number 1 indicates the first ranging sensor connected to Halocode, 2 indicates the second one, and so on.
Ranging Sensor - 图2
You can select the check box on the left of this block to see the distance of the obstacle detected by the ranging sensor on the stage.
Note: This is a reporter block that must be used in combination with another block requiring data.

Example

Ranging Sensor - 图3

When you press the space key, the LED matrix displays the distance of the obstacle detected by the ranging sensor.
Note: Ensure that you have connected an LED matrix to Halocode.


2. ranging sensor[index] outside distance range?

Ranging Sensor - 图4

Detemines whether the obstacle detected by the specified ranging sensor is out of the distance range

How to Use

The distance range refers to the range of the distance that can be detected by the ranging sensor, that is, 2 to 200 cm.
Note: This is a Boolean block that contains a condition. Use it in combination with another block that requires a condition.

Example

Ranging Sensor - 图5

After you press the space key, the LED matrix is turned off if the obstacle detected by the ranging sensor is out of the distance range; and it displays the distance between the obstacle and ranging sensor if the obstacle is within the distance range.
Note: Ensure that you have connected an LED matrix to Halocode.