OpenSwitch

Initializes the NXT touch sensor, sets correct sensor mode

Contents

Syntax

OpenSwitch(port)

OpenSwitch(port, handle)

Description

OpenSound(port) initializes the input mode of NXT switch / touch 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.

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_SetInputMode can be used.

Example

   OpenSwitch(SENSOR_4);
   switchState = GetSwitch(SENSOR_4);
   CloseSensor(SENSOR_4);

See also

NXT_SetInputMode, GetSwitch, CloseSensor, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4,

Signature