|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.nxt.I2CSensor lejos.nxt.addon.tetrix.TetrixMotorController
public class TetrixMotorController
HiTechnic Tetrix Motor Controller abstraction. Provides TetrixMotor
and TetrixEncoderMotor
instances
which are used to control the Tetrix motors.
Use
to retrieve a TetrixControllerFactory.newMotorController()
TetrixMotorController
instance.
TetrixControllerFactory
,
TetrixMotor
,
TetrixEncoderMotor
Field Summary | |
---|---|
static int |
MOTOR_1
Represents Motor 1 as indicated on the controller |
static int |
MOTOR_2
Represents Motor 2 as indicated on the controller |
Fields inherited from class lejos.nxt.I2CSensor |
---|
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION |
Fields inherited from interface lejos.nxt.SensorConstants |
---|
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, GREEN, GREEN_INDEX, MAX_AD_RAW, MAX_TYPE, MIN_TYPE, MODE_ANGLESTEP, MODE_BOOLEAN, MODE_CELSIUS, MODE_FARENHEIT, MODE_PCTFULLSCALE, MODE_PERIODCOUNTER, MODE_RAW, MODE_TRANSITIONCNT, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, 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 |
Constructor Summary | |
---|---|
TetrixMotorController(I2CPort port,
int daisyChainPosition)
Instantiate a HiTechnic TETRIX Motor Controller connected to the given port and daisy chain position. |
Method Summary | |
---|---|
TetrixMotor |
getBasicMotor(int motorID)
Get the TetrixMotor instance that is associated with the motorID . |
TetrixEncoderMotor |
getEncoderMotor(int motorID)
Get the TetrixEncoderMotor instance that is associated with the motorID . |
TetrixRegulatedMotor |
getRegulatedMotor(int motorID)
Get the TetrixRegulatedMotor instance that is associated with the motorID . |
float |
getVoltage()
Return the current battery voltage supplied to the controller. |
Methods inherited from class lejos.nxt.I2CSensor |
---|
fetchString, getAddress, getData, getData, getPort, getProductID, getVendorID, getVersion, sendData, sendData, sendData, setAddress |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MOTOR_1
public static final int MOTOR_2
Constructor Detail |
---|
public TetrixMotorController(I2CPort port, int daisyChainPosition)
port
and daisy chain position.
port
- The sensor port the controller (if daisy-chained, the first) is connected to.daisyChainPosition
- The position of the controller in the daisy chain.
IllegalStateException
- if a Motor Controller was not found with given port
and daisyChainPosition
TetrixControllerFactory.DAISY_CHAIN_POSITION_1
,
TetrixControllerFactory.DAISY_CHAIN_POSITION_2
,
TetrixControllerFactory.DAISY_CHAIN_POSITION_3
,
TetrixControllerFactory.DAISY_CHAIN_POSITION_4
,
SensorPort
Method Detail |
---|
public TetrixMotor getBasicMotor(int motorID)
TetrixMotor
instance that is associated with the motorID
.
motorID
- The motor ID number. This is indicated on the HiTechnic Motor Controller and is
represented using MOTOR_1
or MOTOR_2
.
TetrixMotor
instanceTetrixMotor
,
getEncoderMotor(int)
,
getRegulatedMotor(int)
public TetrixEncoderMotor getEncoderMotor(int motorID)
TetrixEncoderMotor
instance that is associated with the motorID
. The motor must
have an encoder installed for a TetrixEncoderMotor
instance to work correctly.
motorID
- The motor ID number. This is indicated on the HiTechnic Motor Controller and is
represented using MOTOR_1
or MOTOR_2
.
TetrixEncoderMotor
instance
IllegalArgumentException
- if invalid motorID
TetrixEncoderMotor
,
getBasicMotor(int)
,
getRegulatedMotor(int)
public TetrixRegulatedMotor getRegulatedMotor(int motorID)
TetrixRegulatedMotor
instance that is associated with the motorID
. The motor must
have an encoder installed for a TetrixRegulatedMotor
instance to work correctly.
motorID
- The motor ID number. This is indicated on the HiTechnic Motor Controller and is
represented using MOTOR_1
or MOTOR_2
.
TetrixRegulatedMotor
instance
IllegalArgumentException
- if invalid motorID
TetrixRegulatedMotor
,
getBasicMotor(int)
,
getEncoderMotor(int)
public float getVoltage()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |