LEGO MINDSTORMS Robots Manual page 61

Unofficial guide
Table of Contents

Advertisement

Table 4-2. Input Type Constants
Type Constant
SENSOR_TYPE_TOUCH
SENSOR_TYPE_TEMPERATURE
SENSOR_TYPE_LIGHT
SENSOR_TYPE_ROTATION
SetSensorMode(expression sensor, const mode)
Use this command to set the mode of the given input. While the SetSensorType() command is used to specify the electrical characteristics of the input, the SetSensorMode() command
specifies how the input value should be processed. The modes are listed in Table 4-3.
Table 4-3. Input Mode Constants
Mode Constant
SENSOR_MODE_RAW
SENSOR_MODE_BOOL
SENSOR_MODE_EDGE
SENSOR_MODE_PULSE
SENSOR_MODE_PERCENT
SENSOR_MODE_CELSIUS
SENSOR_MODE_FAHRENHEIT
SENSOR_MODE_ROTATION
Internally, input values initially have a raw value from 0 to 1023. Raw values are converted to the input values that your program sees by a process that depends on the input mode. Three of the
modes count events: SENSOR_MODE_EDGE, SENSOR_MODE_PULSE, and SENSOR_MODE_ROTATION. The other modes perform a mathematical scaling operation on the raw input value.
For example, if the input mode is SENSOR_MODE_PERCENT, the RCX converts the raw value into a percent according to the equation:
Sensor Type
Touch sensor
Temperature sensor
Light sensor (powered)
Rotation sensor (powered)
Description
Raw sensor value from 0 to 1023
Either 1 or 0
Counts transitions from 1 to 0 and vice versa
Counts transitions from 1 to 0
Percent from 0 to 100
Celsius temperature
Fahrenheit temperature
Shaft angle, 16 counts per full revolution

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the MINDSTORMS Robots and is the answer not in the manual?

Questions and answers

Table of Contents