public class NXTMMX extends I2CSensor
Create an instance of this class and use the factory methods to provide a MMXRegulatedMotor
or
MMXMotor
instance.
MMXRegulatedMotor
,
MMXMotor
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MMX_ADDRESS
The default I2C address (0x06) for the NXTMMX.
|
static int |
MOTOR_M1
Represents Motor 1 as indicated on the controller
|
static int |
MOTOR_M2
Represents Motor 2 as indicated on the controller
|
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
currentMode, modes
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
Constructor and Description |
---|
NXTMMX(I2CPort port)
Constructor for the NXTMMX
|
NXTMMX(I2CPort port,
int address)
Constructor for the NXTMMX
|
NXTMMX(Port port)
Constructor for the NXTMMX
|
NXTMMX(Port port,
int address)
Constructor for the NXTMMX
|
Modifier and Type | Method and Description |
---|---|
void |
fltMotors()
Synchronized Float both motors
|
MMXMotor |
getBasicMotor(int motorID)
Get a
MMXMotor instance that is associated with the motorID . |
MMXRegulatedMotor |
getRegulatedMotor(int motorID)
Get a
MMXRegulatedMotor instance that is associated with the motorID . |
float |
getVoltage()
Returns the voltage supplied to the NXTMMX
|
void |
stopMotors()
Synchronized stop both motors
|
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
close, releaseOnClose
public static final int MOTOR_M1
public static final int MOTOR_M2
public static final int DEFAULT_MMX_ADDRESS
public NXTMMX(I2CPort port)
port
- - the port its plugged in topublic NXTMMX(Port port)
port
- - the port its plugged in topublic NXTMMX(I2CPort port, int address)
port
- - the sensor port its plugged in toaddress
- The I2C address for the devicepublic NXTMMX(Port port, int address)
port
- - the sensor port its plugged in toaddress
- The I2C address for the devicepublic MMXRegulatedMotor getRegulatedMotor(int motorID)
MMXRegulatedMotor
instance that is associated with the motorID
.motorID
- The motor ID number. This is indicated on the NXTMMX Motor Controller and is
represented using MOTOR_M1
or MOTOR_M2
.MMXRegulatedMotor
instancejava.lang.IllegalArgumentException
- if invalid motorID
java.lang.UnsupportedOperationException
- if motorID
has already been used for a
MMXMotor
motor instance.MMXRegulatedMotor
,
getBasicMotor(int)
public MMXMotor getBasicMotor(int motorID)
MMXMotor
instance that is associated with the motorID
.motorID
- The motor ID number. This is indicated on the NXTMMX Motor Controller and is
represented using MOTOR_M1
or MOTOR_M2
.MMXMotor
instancejava.lang.IllegalArgumentException
- if invalid motorID
java.lang.UnsupportedOperationException
- if motorID
has already been used for a
MMXRegulatedMotor
motor instance.MMXMotor
,
getRegulatedMotor(int)
public float getVoltage()
public void stopMotors()
public void fltMotors()