lejos.nxt.addon
Class RCXLink

java.lang.Object
  extended by lejos.nxt.I2CSensor
      extended by lejos.nxt.addon.RCXLink
All Implemented Interfaces:
SensorConstants, Opcode

public class RCXLink
extends I2CSensor
implements Opcode

Supports Mindsensors NRLink RCX IR adapter.

Author:
Lawrie Griffiths

WARNING: THIS CLASS IS SHARED BETWEEN THE classes AND pccomms PROJECTS. DO NOT EDIT THE VERSION IN pccomms AS IT WILL BE OVERWRITTEN WHEN THE PROJECT IS BUILT.

Field Summary
 RCXMotor A
           
 RCXMotor B
           
static byte BEEP
          NOTE: The BEEP macro is unreliable.
 RCXMotor C
           
static int DELAY
           
static int EEPROM_BUFFER
           
static byte LONG_RANGE_IR
           
static byte MOTOR_A_FORWARD
           
static byte MOTOR_A_REVERSED
           
static byte MOTOR_B_FORWARD
           
static byte MOTOR_B_REVERSED
           
static byte MOTOR_C_FORWARD
           
static byte MOTOR_C_REVERSED
           
static byte POWER_OFF_RCX
           
static byte RUN_PROGRAM_1
           
static byte RUN_PROGRAM_2
           
static byte RUN_PROGRAM_3
           
static byte RUN_PROGRAM_4
           
static byte RUN_PROGRAM_5
           
static byte SHORT_RANGE_IR
           
static byte STOP_ALL_PROGRAMS
           
 
Fields inherited from interface lejos.rcxcomm.Opcode
OPCODE_ABSOLUTE_VALUE, OPCODE_ABSOLUTE_VALUE_REPLY, OPCODE_ADD_TO_VARIABLE, OPCODE_ADD_TO_VARIABLE_REPLY, OPCODE_ALIVE, OPCODE_ALIVE_REPLY, OPCODE_AND_VARIABLE, OPCODE_AND_VARIABLE_REPLY, OPCODE_BRANCH_ALWAYS_FAR, OPCODE_BRANCH_ALWAYS_NEAR, OPCODE_CALL_SUBROUTINE, OPCODE_CLEAR_MESSAGE, OPCODE_CLEAR_SENSOR_VALUE, OPCODE_CLEAR_SENSOR_VALUE_REPLY, OPCODE_CLEAR_TIMER, OPCODE_CLEAR_TIMER_REPLY, OPCODE_DATALOG_NEXT, OPCODE_DATALOG_NEXT_REPLY, OPCODE_DECREMENT_LOOP_COUNTER_FAR, OPCODE_DECREMENT_LOOP_COUNTER_NEAR, OPCODE_DELETE_ALL_SUBROUTINES, OPCODE_DELETE_ALL_SUBROUTINES_REPLY, OPCODE_DELETE_ALL_TASKS, OPCODE_DELETE_ALL_TASKS_REPLY, OPCODE_DELETE_FIRMWARE, OPCODE_DELETE_FIRMWARE_REPLY, OPCODE_DELETE_SUBROUTINE, OPCODE_DELETE_SUBROUTINE_REPLY, OPCODE_DELETE_TASK, OPCODE_DELETE_TASK_REPLY, OPCODE_DIVIDE_VARIABLE, OPCODE_DIVIDE_VARIABLE_REPLY, OPCODE_GET_BATTERY_POWER, OPCODE_GET_BATTERY_POWER_REPLY, OPCODE_GET_MEMORY_MAP, OPCODE_GET_MEMORY_MAP_REPLY, OPCODE_GET_VALUE, OPCODE_GET_VALUE_REPLY, OPCODE_GET_VERSIONS, OPCODE_GET_VERSIONS_REPLY, OPCODE_MASK, OPCODE_MULTIPLY_VARIABLE, OPCODE_MULTIPLY_VARIABLE_REPLY, OPCODE_OR_VARIABLE, OPCODE_OR_VARIABLE_REPLY, OPCODE_PLAY_SOUND_REPLY, OPCODE_PLAY_TONE, OPCODE_PLAY_TONE_REPLY, OPCODE_POWER_OFF, OPCODE_POWER_OFF_REPLY, OPCODE_REMOTE_COMMAND, OPCODE_SEND_MESSAGE, OPCODE_SET_DATALOG_SIZE, OPCODE_SET_DATALOG_SIZE_REPLY, OPCODE_SET_DISPLAY, OPCODE_SET_DISPLAY_REPLY, OPCODE_SET_LOOP_COUNTER, OPCODE_SET_MESSAGE, OPCODE_SET_MOTOR_DIRECTION, OPCODE_SET_MOTOR_DIRECTION_REPLY, OPCODE_SET_MOTOR_ON_OFF, OPCODE_SET_MOTOR_ON_OFF_REPLY, OPCODE_SET_MOTOR_POWER, OPCODE_SET_MOTOR_POWER_REPLY, OPCODE_SET_POWER_DOWN_DELAY, OPCODE_SET_POWER_DOWN_DELAY_REPLY, OPCODE_SET_PROGRAM_NUMBER, OPCODE_SET_PROGRAM_NUMBER_REPLY, OPCODE_SET_SENSOR_MODE, OPCODE_SET_SENSOR_MODE_REPLY, OPCODE_SET_SENSOR_TYPE, OPCODE_SET_SENSOR_TYPE_REPLY, OPCODE_SET_TIME, OPCODE_SET_TIME_REPLY, OPCODE_SET_TRANSMITTER_RANGE, OPCODE_SET_TRANSMITTER_RANGE_REPLY, OPCODE_SET_VARIABLE, OPCODE_SET_VARIABLE_REPLY, OPCODE_SIGN_VARIABLE, OPCODE_SIGN_VARIABLE_REPLY, OPCODE_START_FIRMWARE_DOWNLOAD, OPCODE_START_FIRMWARE_DOWNLOAD_REPLY, OPCODE_START_SUBROUTINE_DOWNLOAD, OPCODE_START_SUBROUTINE_DOWNLOAD_REPLY, OPCODE_START_TASK, OPCODE_START_TASK_DOWNLOAD, OPCODE_START_TASK_DOWNLOAD_REPLY, OPCODE_START_TASK_REPLY, OPCODE_STOP_ALL_TASKS, OPCODE_STOP_ALL_TASKS_REPLY, OPCODE_STOP_TASK, OPCODE_STOP_TASK_REPLY, OPCODE_SUBTRACT_FROM_VARIABLE, OPCODE_SUBTRACT_FROM_VARIABLE_REPLY, OPCODE_TEST_AND_BRANCH_FAR, OPCODE_TEST_AND_BRANCH_NEAR, OPCODE_TRANSFER_DATA, OPCODE_TRANSFER_DATA_REPLY, OPCODE_UNLOCK_FIRMWARE, OPCODE_UNLOCK_FIRMWARE_REPLY, OPCODE_UPLOAD_DATALOG, OPCODE_UPLOAD_DATALOG_REPLY, OPCODE_WAIT
 
Fields inherited from interface lejos.nxt.SensorConstants
MODE_ANGLESTEP, MODE_BOOLEAN, MODE_CELSIUS, MODE_FARENHEIT, MODE_PCTFULLSCALE, MODE_PERIODCOUNTER, MODE_RAW, MODE_TRANSITIONCNT, TYPE_ANGLE, TYPE_CUSTOM, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE
 
Constructor Summary
RCXLink(I2CPort port)
           
 
Method Summary
 void backward(int id)
           
 void backwardStep(int id)
           
 void beep()
           
 int bytesAvailable()
           
 void defineAndRun(byte[] macro, int len)
           
 void defineMacro(int addr, byte[] macro)
           
 void fltMotor(int id)
           
 void flush()
           
 void forward(int id)
           
 void forwardStep(int id)
           
 int getStatus()
           
 void ping()
           
 void powerOff()
           
 int readBytes(byte[] data)
           
 void runMacro(int addr)
           
 void runProgram(int programNumber)
           
 void sendBytes(byte[] data, int len)
           
 void sendF7(int msg)
           
 void sendRemoteCommand(int msg)
           
 void setAPDAOff()
           
 void setAPDAOn()
           
 void setDefaultSpeed()
           
 void setHighSpeed()
           
 void setMotorPower(int id, int power)
           
 void setRangeLong()
           
 void setRangeShort()
           
 void setRawMode()
           
 void setRCXRangeLong()
           
 void setRCXRangeShort()
           
 void startMotor(int id)
           
 void stopAllPrograms()
           
 void stopMotor(int id)
           
 
Methods inherited from class lejos.nxt.I2CSensor
fetchString, getData, getPort, getProductID, getSensorType, getVersion, sendData, sendData, setAddress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

A

public RCXMotor A

B

public RCXMotor B

C

public RCXMotor C

SHORT_RANGE_IR

public static final byte SHORT_RANGE_IR
See Also:
Constant Field Values

LONG_RANGE_IR

public static final byte LONG_RANGE_IR
See Also:
Constant Field Values

POWER_OFF_RCX

public static final byte POWER_OFF_RCX
See Also:
Constant Field Values

RUN_PROGRAM_1

public static final byte RUN_PROGRAM_1
See Also:
Constant Field Values

RUN_PROGRAM_2

public static final byte RUN_PROGRAM_2
See Also:
Constant Field Values

RUN_PROGRAM_3

public static final byte RUN_PROGRAM_3
See Also:
Constant Field Values

RUN_PROGRAM_4

public static final byte RUN_PROGRAM_4
See Also:
Constant Field Values

RUN_PROGRAM_5

public static final byte RUN_PROGRAM_5
See Also:
Constant Field Values

STOP_ALL_PROGRAMS

public static final byte STOP_ALL_PROGRAMS
See Also:
Constant Field Values

MOTOR_A_FORWARD

public static final byte MOTOR_A_FORWARD
See Also:
Constant Field Values

MOTOR_A_REVERSED

public static final byte MOTOR_A_REVERSED
See Also:
Constant Field Values

MOTOR_B_FORWARD

public static final byte MOTOR_B_FORWARD
See Also:
Constant Field Values

MOTOR_B_REVERSED

public static final byte MOTOR_B_REVERSED
See Also:
Constant Field Values

MOTOR_C_FORWARD

public static final byte MOTOR_C_FORWARD
See Also:
Constant Field Values

MOTOR_C_REVERSED

public static final byte MOTOR_C_REVERSED
See Also:
Constant Field Values

BEEP

public static final byte BEEP
NOTE: The BEEP macro is unreliable. It works once, and then needs another command executed before it works again.

See Also:
Constant Field Values

EEPROM_BUFFER

public static final int EEPROM_BUFFER
See Also:
Constant Field Values

DELAY

public static final int DELAY
See Also:
Constant Field Values
Constructor Detail

RCXLink

public RCXLink(I2CPort port)
Method Detail

runMacro

public void runMacro(int addr)

beep

public void beep()

runProgram

public void runProgram(int programNumber)

forwardStep

public void forwardStep(int id)

backwardStep

public void backwardStep(int id)

setRCXRangeShort

public void setRCXRangeShort()

setRCXRangeLong

public void setRCXRangeLong()

powerOff

public void powerOff()

stopAllPrograms

public void stopAllPrograms()

flush

public void flush()

setDefaultSpeed

public void setDefaultSpeed()

setHighSpeed

public void setHighSpeed()

setRangeLong

public void setRangeLong()

setRangeShort

public void setRangeShort()

setAPDAOn

public void setAPDAOn()

setAPDAOff

public void setAPDAOff()

defineMacro

public void defineMacro(int addr,
                        byte[] macro)

getStatus

public int getStatus()

bytesAvailable

public int bytesAvailable()

ping

public void ping()

sendF7

public void sendF7(int msg)

sendRemoteCommand

public void sendRemoteCommand(int msg)

setMotorPower

public void setMotorPower(int id,
                          int power)

stopMotor

public void stopMotor(int id)

startMotor

public void startMotor(int id)

fltMotor

public void fltMotor(int id)

forward

public void forward(int id)

backward

public void backward(int id)

setRawMode

public void setRawMode()

sendBytes

public void sendBytes(byte[] data,
                      int len)

readBytes

public int readBytes(byte[] data)

defineAndRun

public void defineAndRun(byte[] macro,
                         int len)