Package lejos.hardware.device
Class PFLink
- java.lang.Object
-
- lejos.hardware.Device
-
- lejos.hardware.sensor.BaseSensor
-
- lejos.hardware.sensor.I2CSensor
-
- lejos.hardware.device.PFLink
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,SensorConstants,SensorMode,SensorModes,SampleProvider
public class PFLink extends I2CSensor
Class for controlling PF Motors with MindSensors NRLink-Nx- Author:
- Alexander Vegh
-
-
Field Summary
-
Fields inherited from class lejos.hardware.sensor.I2CSensor
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
-
Fields inherited from class lejos.hardware.sensor.BaseSensor
currentMode, modes
-
Fields inherited from interface lejos.hardware.sensor.SensorConstants
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, BROWN, GREEN, GREEN_INDEX, MAX_TYPE, MIN_TYPE, MODE_RAW, NXT_ADC_RES, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HIGHSPEED, TYPE_HIGHSPEED_9V, TYPE_HISPEED, 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, WHITE, YELLOW
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinitialize(byte _Range)Should be called once to set up the NRLink for usage in the programvoidinstallDefaultMacros()Installs the macro definitions used by this class.voidinstallMacro(int _Address, byte[] _Macro)Installs a macro into the NRLink You really should call this only once for a new NRLink since it stores them in EEPROM even if turned of.voidrunCommand(int command)Executes a commandvoidrunMacro(int _Address)Runs a macro which has been previously installed on the NRLink.-
Methods inherited from class lejos.hardware.sensor.I2CSensor
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
-
Methods inherited from class lejos.hardware.sensor.BaseSensor
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
-
Methods inherited from class lejos.hardware.Device
close, releaseOnClose
-
-
-
-
Field Detail
-
NR_RANGE_SHORT
public static final byte NR_RANGE_SHORT
- See Also:
- Constant Field Values
-
NR_RANGE_LONG
public static final byte NR_RANGE_LONG
- See Also:
- Constant Field Values
-
MOTOR_CH1_A_FLOAT
public static final int MOTOR_CH1_A_FLOAT
- See Also:
- Constant Field Values
-
MOTOR_CH1_A_FORWARD
public static final int MOTOR_CH1_A_FORWARD
- See Also:
- Constant Field Values
-
MOTOR_CH1_A_REVERSE
public static final int MOTOR_CH1_A_REVERSE
- See Also:
- Constant Field Values
-
MOTOR_CH1_A_BRAKE
public static final int MOTOR_CH1_A_BRAKE
- See Also:
- Constant Field Values
-
MOTOR_CH1_B_FLOAT
public static final int MOTOR_CH1_B_FLOAT
- See Also:
- Constant Field Values
-
MOTOR_CH1_B_FORWARD
public static final int MOTOR_CH1_B_FORWARD
- See Also:
- Constant Field Values
-
MOTOR_CH1_B_REVERSE
public static final int MOTOR_CH1_B_REVERSE
- See Also:
- Constant Field Values
-
MOTOR_CH1_B_BRAKE
public static final int MOTOR_CH1_B_BRAKE
- See Also:
- Constant Field Values
-
MOTOR_CH2_A_FLOAT
public static final int MOTOR_CH2_A_FLOAT
- See Also:
- Constant Field Values
-
MOTOR_CH2_A_FORWARD
public static final int MOTOR_CH2_A_FORWARD
- See Also:
- Constant Field Values
-
MOTOR_CH2_A_REVERSE
public static final int MOTOR_CH2_A_REVERSE
- See Also:
- Constant Field Values
-
MOTOR_CH2_A_BRAKE
public static final int MOTOR_CH2_A_BRAKE
- See Also:
- Constant Field Values
-
MOTOR_CH2_B_FLOAT
public static final int MOTOR_CH2_B_FLOAT
- See Also:
- Constant Field Values
-
MOTOR_CH2_B_FORWARD
public static final int MOTOR_CH2_B_FORWARD
- See Also:
- Constant Field Values
-
MOTOR_CH2_B_REVERSE
public static final int MOTOR_CH2_B_REVERSE
- See Also:
- Constant Field Values
-
MOTOR_CH2_B_BRAKE
public static final int MOTOR_CH2_B_BRAKE
- See Also:
- Constant Field Values
-
MOTOR_CH3_A_FLOAT
public static final int MOTOR_CH3_A_FLOAT
- See Also:
- Constant Field Values
-
MOTOR_CH3_A_FORWARD
public static final int MOTOR_CH3_A_FORWARD
- See Also:
- Constant Field Values
-
MOTOR_CH3_A_REVERSE
public static final int MOTOR_CH3_A_REVERSE
- See Also:
- Constant Field Values
-
MOTOR_CH3_A_BRAKE
public static final int MOTOR_CH3_A_BRAKE
- See Also:
- Constant Field Values
-
MOTOR_CH3_B_FLOAT
public static final int MOTOR_CH3_B_FLOAT
- See Also:
- Constant Field Values
-
MOTOR_CH3_B_FORWARD
public static final int MOTOR_CH3_B_FORWARD
- See Also:
- Constant Field Values
-
MOTOR_CH3_B_REVERSE
public static final int MOTOR_CH3_B_REVERSE
- See Also:
- Constant Field Values
-
MOTOR_CH3_B_BRAKE
public static final int MOTOR_CH3_B_BRAKE
- See Also:
- Constant Field Values
-
MOTOR_CH4_A_FLOAT
public static final int MOTOR_CH4_A_FLOAT
- See Also:
- Constant Field Values
-
MOTOR_CH4_A_FORWARD
public static final int MOTOR_CH4_A_FORWARD
- See Also:
- Constant Field Values
-
MOTOR_CH4_A_REVERSE
public static final int MOTOR_CH4_A_REVERSE
- See Also:
- Constant Field Values
-
MOTOR_CH4_A_BRAKE
public static final int MOTOR_CH4_A_BRAKE
- See Also:
- Constant Field Values
-
MOTOR_CH4_B_FLOAT
public static final int MOTOR_CH4_B_FLOAT
- See Also:
- Constant Field Values
-
MOTOR_CH4_B_FORWARD
public static final int MOTOR_CH4_B_FORWARD
- See Also:
- Constant Field Values
-
MOTOR_CH4_B_REVERSE
public static final int MOTOR_CH4_B_REVERSE
- See Also:
- Constant Field Values
-
MOTOR_CH4_B_BRAKE
public static final int MOTOR_CH4_B_BRAKE
- See Also:
- Constant Field Values
-
COMBO_CH1_A_FORWARD_B_FORWARD
public static final int COMBO_CH1_A_FORWARD_B_FORWARD
- See Also:
- Constant Field Values
-
COMBO_CH1_A_FORWARD_B_REVERSE
public static final int COMBO_CH1_A_FORWARD_B_REVERSE
- See Also:
- Constant Field Values
-
COMBO_CH1_A_REVERSE_B_FORWARD
public static final int COMBO_CH1_A_REVERSE_B_FORWARD
- See Also:
- Constant Field Values
-
COMBO_CH1_A_REVERSE_B_REVERSE
public static final int COMBO_CH1_A_REVERSE_B_REVERSE
- See Also:
- Constant Field Values
-
COMBO_CH2_A_FORWARD_B_FORWARD
public static final int COMBO_CH2_A_FORWARD_B_FORWARD
- See Also:
- Constant Field Values
-
COMBO_CH2_A_FORWARD_B_REVERSE
public static final int COMBO_CH2_A_FORWARD_B_REVERSE
- See Also:
- Constant Field Values
-
COMBO_CH2_A_REVERSE_B_FORWARD
public static final int COMBO_CH2_A_REVERSE_B_FORWARD
- See Also:
- Constant Field Values
-
COMBO_CH2_A_REVERSE_B_REVERSE
public static final int COMBO_CH2_A_REVERSE_B_REVERSE
- See Also:
- Constant Field Values
-
COMBO_CH3_A_FORWARD_B_FORWARD
public static final int COMBO_CH3_A_FORWARD_B_FORWARD
- See Also:
- Constant Field Values
-
COMBO_CH3_A_FORWARD_B_REVERSE
public static final int COMBO_CH3_A_FORWARD_B_REVERSE
- See Also:
- Constant Field Values
-
COMBO_CH3_A_REVERSE_B_FORWARD
public static final int COMBO_CH3_A_REVERSE_B_FORWARD
- See Also:
- Constant Field Values
-
COMBO_CH3_A_REVERSE_B_REVERSE
public static final int COMBO_CH3_A_REVERSE_B_REVERSE
- See Also:
- Constant Field Values
-
COMBO_CH4_A_FORWARD_B_FORWARD
public static final int COMBO_CH4_A_FORWARD_B_FORWARD
- See Also:
- Constant Field Values
-
COMBO_CH4_A_FORWARD_B_REVERSE
public static final int COMBO_CH4_A_FORWARD_B_REVERSE
- See Also:
- Constant Field Values
-
COMBO_CH4_A_REVERSE_B_FORWARD
public static final int COMBO_CH4_A_REVERSE_B_FORWARD
- See Also:
- Constant Field Values
-
COMBO_CH4_A_REVERSE_B_REVERSE
public static final int COMBO_CH4_A_REVERSE_B_REVERSE
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(byte _Range)
Should be called once to set up the NRLink for usage in the program- Parameters:
_Range- Either NR_RANGE_SHORT or NR_RANGE_LONG, which uses more power
-
runCommand
public void runCommand(int command)
Executes a command- Parameters:
command-
-
installMacro
public void installMacro(int _Address, byte[] _Macro)Installs a macro into the NRLink You really should call this only once for a new NRLink since it stores them in EEPROM even if turned of. And I have no idea how often you can overwrite them before they burn out...- Parameters:
_Address- The address up from 0x40 for the macro_Macro- The macro
-
installDefaultMacros
public void installDefaultMacros()
Installs the macro definitions used by this class. You really should call this only once for a new NRLink since it stores them in EEPROM even if turned of. And I have no idea how often you can overwrite them before they burn out...
-
runMacro
public void runMacro(int _Address)
Runs a macro which has been previously installed on the NRLink.- Parameters:
_Address- The address of the macro, one of the MOTOR_* for a single motor or one of the COMBO_* macros which work on both motors simultaneously
-
-