GetInfrared

Reads the current value of the Hitechnic infrared sensor (infrared seeker)

Contents

Syntax

[direction rawData] = GetInfrared(port)

[direction rawData] = GetInfrared(port, handle)

Description

[direction rawData] = GetInfrared(port) returns the current direction an the raw data of the detected infrared signal. direction represents the main direction (1-9) calculated based on the measured raw data given in the rawData vector (1x5). Five sensors are provided by the infrared seeker. For more information see http://www.hitechnic.com

The given port number specifies the connection port. The value port can be addressed by the symbolic constants SENSOR_1 , SENSOR_2, SENSOR_3 and SENSOR_4 analog to the labeling on the NXT Brick.

The last optional argument can be a valid NXT handle. If none is specified, the default handle will be used (call COM_SetDefaultNXT to set one).

Example

   OpenInfrared(SENSOR_4);
   [direction rawData] = GetInfrared(SENSOR_4);
   CloseSensor(SENSOR_4);

See also

OpenInfrared, CloseSensor, COM_ReadI2C,

Signature