Explanation
|
The RCX robot controller contains a
number of built-in variables. It has three inputs which
may be connected to many different sensors. Before using
a sensor, it is necessary to define the type of sensor
which is attached to the input, as well as the format of
the data which the sensor is expected to deliver. The
first input is the number of the sensor or a list of
sensor numbers. Valid numbers are 1 through 3.
The RCX contains four timers. The resolution of a
timer is 1/10 second, which means that the value of the
timer increases by 10 every second. Storing any value
into a timer resets the timer to Zero.
The RCX is able to communicate with other RCX robot
controllers by sending simple messages, consisting of a
value between 0 and 255. This command broadcasts a value
between 0 and 255 to all other RCX devices, where the
value can be examined by checking the .MESSAGE variable.
This feature is very simple; it does not, for example,
check whether other RCX devices send a command at the
same time, causing possible confusion in infrared
cyberspace.
| Name |
Function |
Value when Read |
When Written |
| .TIMER1 to .TIMER4 |
timers |
the timer value |
timer is reset to 0 |
| .MOTOR1 to .MOTOR3 |
motor status |
a combined value |
--- |
| .SENSOR1 to .SENSOR3 |
sensor inputs |
the sensor value |
sensor is cleared |
| .RAW1 to .RAW 3 |
sensor inputs |
the raw sensor value |
sensor is cleared |
| .TYPE1 to .TYPE3 |
sensor types |
0 to 5 |
--- |
| .MODE1 to .MODE3 |
sensor modes |
combined value |
--- |
| CLOCK |
the clock |
minutes since midnight |
hours*100 + minutes |
| .MESSAGE |
broadcast message |
the last msg received |
msg is broadcast |
| ?nnn |
random number |
between 0 and nnn |
--- |
Explanation of Values
| Motors |
| The power level |
0 to 7 |
| 64 |
if motor is turned off (additional value) |
| 128 |
if direction is forward (additional value) |
| Sensor Types |
| 0 |
raw data |
| 1 |
switch |
| 2 |
temperature |
| 3 |
light |
| 4 |
rotation |
| Sensor Types |
| Value |
Type |
Data Range |
| 0 |
raw data |
0 to 1023 |
| 32 |
switch |
0 or 1 |
| 64 |
edge |
level transition count |
| 96 |
percentage |
0 to 100 |
| 128 |
pulse |
1->0 transition count |
| 160 |
degrees C |
-20 to 50 |
| 192 |
degrees F |
-2 to 120 |
| 224 |
anle |
16 per rotation
plus a slope from 0-31 |
|