1. magnetic sensor[index] detected magnetic body?

Magnetic Sensor - 图1

Determines whether the specified magnetic sensor detects a magnetic body

How to Use

The magnetic sensor can be used to detect magnetic bodies around it. For example, sweeping robots determine whether to go foward through magnetic field detection.
The number in this block indicates the place of a magnetic sensor among the ones connected to Halocode. As shown in the following figure, the number 1 indicates the first magnetic sensor connected to Halocode, 2 indicates the second one, and so on.

Magnetic Sensor - 图2

Note: This is a Boolean block that contains a condition. Use it in combination with another block that requires a condition.

Example

After you press the space key, put a magnetic body near the first magnetic sensor connected to Halocode. All the LEDs on Halocode light up in yellow.

Magnetic Sensor - 图3


2. magnetic sensor[index] number of times magnetic body detected

Magnetic Sensor - 图4

Report the number of times the specified magnetic sensor detects a magnetic body

How to Use

This is a reporter block that must be used in combiantion with another block requiring data.
You can select the check box on the left of this block to see the number of times the magnetic sensor detects a magnetic body on the stage.

Example

After press the space key, put a magnetic body near the first magnetic sensor connected to Halocode. All the LEDs on Halocode light up in yellow, and the first LED matrix connected to Halocode displays the number of times.
Note: Ensure that you have connected an LED matrix to Halocode.

Magnetic Sensor - 图5


3. magnetic sensor [index] resets counts

Magnetic Sensor - 图6

Resets the number of times the specified magnetic sensor detects a magnetic body to zero

How to Use

This block is used to reset the number of times a magnetic sensor detects a magnetic body to zero.

Example

When you press the space key, the first LED matrix connected to Halocode displays the number 0.
Note: Ensure that you have connected an LED matrix to Halocode.

Magnetic Sensor - 图7