OpenColor
Initializes and sets the mode of the HiTechnic color sensor
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.
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.
Examples
OpenColor(SENSOR_2); [index r g b] = GetColor(SENSOR_2, 0); CloseSensor(SENSOR_2);
See also
GetColor, CloseSensor, COM_ReadI2C, NXT_LSGetStatus, NXT_LSRead,
Signature
- Author: Rainer Schnitzler (see AUTHORS)
- Date: 2008/10/01
- Copyright: 2007-2009, RWTH Aachen University