GetLight

Reads the current value of the NXT light sensor

Contents

Syntax

light = GetLight(port)

light = GetLight(port, handle)

Description

light = GetLight(port) returns the current light value light of the NXT light sensor. The measurement value light represents the normalized (default) light value (0..1023 / 10 Bit). The normalized value mode is set per default by the function OpenLight. 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).

For more complex settings the function NXT_GetInputValues can be used.

Examples

   OpenLight(SENSOR_1, 'ACTIVE');
   light = GetLight(SENSOR_1);
   CloseSensor(SENSOR_1);

See also

OpenLight, CloseSensor, NXT_GetInputValues, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4,

Signature