OpenColor

Initializes the HiTechnic color V1 or V2 sensor, sets correct sensor mode

Contents

Syntax

OpenColor(port)

OpenColor(port, handle)

Description

OpenColor(port) initializes the input mode of HiTechnic Color sensor specified by the sensor 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. This function works for both HiTechnic Color sensors V1 and V2.

With GetColor(port) you can receive color values as RGB or Index.

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).

Since the Color sensor is a digital sensor (that uses the I²C protocol), the function NXT_SetInputMode cannot be used as for analog sensors.

Limitations

It's by design that the white LED of the Color sensors cannot be turned off by calling CloseSensor. It's always on when the sensor is connected. The V2 hardware version of the sensor performs significantly better than the V1 version.

Examples

   OpenColor(SENSOR_2);
   [index r g b] = GetColor(SENSOR_2, 0);
   CloseSensor(SENSOR_2);

See also

GetColor, CalibrateColor, CloseSensor, OpenNXT2Color, GetNXT2Color, COM_ReadI2C,

Signature