RCX: Sensors
Provides processes and constants for manipulating sensors connected to the RCX's three input ports.
SENSOR - Sensor numbersSENSOR.1 - Sensor port 1SENSOR.2 - Sensor port 2SENSOR.3 - Sensor port 3SENSOR - Types for sensor value readingsSENSOR.BOOL - BooleanSENSOR.RAW - Raw valuesSENSOR.VAL - Sensor values formatted as per the 'mode'SENSOR.MODE - Sensor mode Defines the kind of values received from the sensorSENSOR.MODE - The sensor read mode to be used with a specific sensorSENSOR.MODE.ANGLE - Angle (rotation)SENSOR.MODE.BOOL - BooleanSENSOR.MODE.CELSIUS - Degrees CelsiusSENSOR.MODE.EDGE - Edge, every transitionSENSOR.MODE.FARENHEIT - Degrees FarenheitSENSOR.MODE.PERCENT - PercentageSENSOR.MODE.PULSE - Pulse, only on -ve transitionSENSOR.MODE.RAW - Raw valuesSENSOR.T - A sensor readingboolean - Boolean valuemode - Read mode (see SENSOR.MODE constants)raw - Raw sensor valuetype - Type of the sensorvalue - Value according to read modeSENSOR.TYPE - Used for the 4 main types of LEGO sensors to initialise the read mode and activity appropriately, along with a 'raw' unconfigured modeSENSOR.TYPE - Different sensor types that may be connected to the input ports of the RCXSENSOR.LIGHT - Light sensorSENSOR.RAW - Raw sensor, useful for custom RCX sensors or where the mode of the sensor being inferred is not desirableSENSOR.ROTATION - Rotation sensorSENSOR.TEMP - Temperature sensorSENSOR.TOUCH - Touch (bump) sensorread.sensor - Direct read value from a sensor This process is used for low-level reading, for normal use use the sensor processsensor - Read from a sensor to a channel This process will read values from the sensor at the time interval specified in the delay to the output channelsensor.active - Set the sensor to 'active' mode, with power (sensor dependant)sensor.addr - Sensor memory addressessensor.passive - Set the sensor to 'passive' mode, without power (sensor dependant)SENSOR.TYPE
DATA TYPE SENSOR.TYPE
Used for the 4 main types of LEGO sensors to initialise the read mode and activity appropriately, along with a 'raw' unconfigured mode.
SENSOR.TYPE
Different sensor types that may be connected to the input ports of the RCX.
SENSOR.RAW
VAL SENSOR.TYPE SENSOR.RAW
Raw sensor, useful for custom RCX sensors or where the mode of the sensor being inferred is not desirable.
SENSOR.TOUCH
VAL SENSOR.TYPE SENSOR.TOUCH
Touch (bump) sensor.
SENSOR.TEMP
VAL SENSOR.TYPE SENSOR.TEMP
Temperature sensor.
SENSOR.LIGHT
VAL SENSOR.TYPE SENSOR.LIGHT
Light sensor.
SENSOR.ROTATION
VAL SENSOR.TYPE SENSOR.ROTATION
Rotation sensor.
SENSOR.MODE
DATA TYPE SENSOR.MODE
Sensor mode Defines the kind of values received from the sensor.
SENSOR.MODE
The sensor read mode to be used with a specific sensor.
SENSOR.MODE.RAW
VAL SENSOR.MODE SENSOR.MODE.RAW
Raw values.
SENSOR.MODE.BOOL
VAL SENSOR.MODE SENSOR.MODE.BOOL
Boolean
SENSOR.MODE.EDGE
VAL SENSOR.MODE SENSOR.MODE.EDGE
Edge, every transition.
SENSOR.MODE.PULSE
VAL SENSOR.MODE SENSOR.MODE.PULSE
Pulse, only on -ve transition.
SENSOR.MODE.PERCENT
VAL SENSOR.MODE SENSOR.MODE.PERCENT
Percentage
SENSOR.MODE.CELSIUS
VAL SENSOR.MODE SENSOR.MODE.CELSIUS
Degrees Celsius.
SENSOR.MODE.FARENHEIT
VAL SENSOR.MODE SENSOR.MODE.FARENHEIT
Degrees Farenheit.
SENSOR.MODE.ANGLE
VAL SENSOR.MODE SENSOR.MODE.ANGLE
Angle (rotation)
SENSOR
Sensor numbers
SENSOR.1
VAL INT SENSOR.1
Sensor port 1.
SENSOR.2
VAL INT SENSOR.2
Sensor port 2.
SENSOR.3
VAL INT SENSOR.3
Sensor port 3.
sensor.addr
VAL [3]INT sensor.addr
Sensor memory addresses
sensor.active
PROC sensor.active (VAL INT sensor.num)
Set the sensor to 'active' mode, with power (sensor dependant).
VAL INT |
sensor.num |
Number of the sensor port to set passive. |
sensor.passive
PROC sensor.passive (VAL INT sensor.num)
Set the sensor to 'passive' mode, without power (sensor dependant).
VAL INT |
sensor.num |
Number of the sensor port to set active. |
SENSOR
Types for sensor value readings.
SENSOR.VAL
DATA TYPE SENSOR.VAL
Sensor values formatted as per the 'mode'.
SENSOR.RAW
DATA TYPE SENSOR.RAW
Raw values
SENSOR.BOOL
DATA TYPE SENSOR.BOOL
Boolean
SENSOR.T
DATA TYPE SENSOR.T
A sensor reading.
type
SENSOR.TYPE type
Type of the sensor
mode
SENSOR.MODE mode
Read mode (see SENSOR.MODE constants)
raw
SENSOR.VAL raw
Raw sensor value.
value
SENSOR.VAL value
Value according to read mode.
boolean
SENSOR.BOOL boolean
Boolean value.
read.sensor
PROC read.sensor (VAL INT num, RESULT SENSOR.T reading)
Direct read value from a sensor This process is used for low-level reading, for normal use use the sensor process.
VAL INT |
num |
The sensor port number |
RESULT SENSOR.T |
reading |
The type and mode of the sensor, returned with raw, value and boolean completed. |
sensor
PROC sensor (VAL INT num, VAL INT delay, VAL SENSOR.TYPE type, VAL SENSOR.MODE mode, CHAN SENSOR.VAL out!)
Read from a sensor to a channel This process will read values from the sensor at the time interval specified in the delay to the output channel.
VAL INT |
num |
The sensor port number |
VAL INT |
delay |
The delay between reads from the sensor. |
VAL SENSOR.TYPE |
type |
The sensor type |
VAL SENSOR.MODE |
mode |
The value read mode of the sensor. |
CHAN SENSOR.VAL |
out |
The channel that outputs are written to. |