CalibrateColor

Enables calibration mode of the HiTechnic color sensor V1

Contents

Syntax

CalibrateColor(port, mode)

CalibrateColor(port, mode, handle)

Description

Do not use this function with the HiTechnic Color Sensor V2. It has a bright white flashing LED. This function is intended for the HiTechnic Color Sensor V1 (milky, weak white LED).

Calibrate the color sensor with white and black reference value. It's not known whether calibration of the color sensor makes sense. HiTechnic doku says nothing, some people say it is necessary, but it works and has effect ;-). The sensor LEDs make a short flash after successful calibration. When calibrated, the sensor keeps this information in non-volatile memory. There are two different modes for calibration:

The color sensor has to be opened (using OpenColor) before execution.

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

     % color must be open for calibration
     OpenColor(SENSOR_2);

     % white calibration mode
     CalibrateColor(SENSOR_2, 1);
     % pause for changing position
     pause(5);
     % black calibration mode
     CalibrateColor(SENSOR_2, 2);

See also

OpenColor, GetColor, CloseSensor,

Signature