lejos.nxt.addon
Class NXTMMX

java.lang.Object
  extended by lejos.nxt.I2CSensor
      extended by lejos.nxt.addon.NXTMMX
All Implemented Interfaces:
SensorConstants

public class NXTMMX
extends I2CSensor

Supports the Mindsensors NXTMMX motor multiplexor. This device allows you to connect two additional motors to your robot using a sensor port. Multiple NXTMMXs can be chained together when addressed correctly.

Create an instance of this class to pass to the constructor of a MMXRegulatedMotor or MMXMotorinstance.

Author:
Michael D. Smith mdsmitty@gmail.com, Kirk P Thompsonn
See Also:
MMXRegulatedMotor, MMXMotor

Field Summary
static int DEFAULT_MMX_ADDRESS
           
static int MMX_MOTOR_1
          NXTMMX Motor 1.
static int MMX_MOTOR_2
          NXTMMX Motor 2.
 
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
NXTMMX(SensorPort port)
          Constructor for the NXTMMX
NXTMMX(SensorPort port, int address)
          Constructor for the NXTMMX
 
Method Summary
 void fltMotors()
          Floats both motors
 float getVoltage()
          Returns the voltage supplied to the NXTMMX
 boolean isAutoStart()
          Determines if motors will automatically start or not.
 void reset()
          resets mux values to default and stops all tasks.
 void setAutoStart(boolean autoStart)
          Turns autostart on or off.
 void startMotors()
          Starts both motors at the same time.
 void stopMotors()
          Stops both motors
 
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

DEFAULT_MMX_ADDRESS

public static final int DEFAULT_MMX_ADDRESS
See Also:
Constant Field Values

MMX_MOTOR_1

public static final int MMX_MOTOR_1
NXTMMX Motor 1. This ID is used to bind a MMXRegulatedMotor to M1 of the NXTMMX.

See Also:
MMXRegulatedMotor.MMXRegulatedMotor(lejos.nxt.addon.NXTMMX, int), Constant Field Values

MMX_MOTOR_2

public static final int MMX_MOTOR_2
NXTMMX Motor 2. This ID is used to bind a MMXRegulatedMotor to M2 of the NXTMMX.

See Also:
MMXRegulatedMotor.MMXRegulatedMotor(lejos.nxt.addon.NXTMMX, int), Constant Field Values
Constructor Detail

NXTMMX

public NXTMMX(SensorPort port,
              int address)
Constructor for the NXTMMX

Parameters:
port - - the sensor port its plugged in to
address - The I2C address for the device
See Also:
SensorPort.S1, SensorPort.S2, SensorPort.S3, SensorPort.S4

NXTMMX

public NXTMMX(SensorPort port)
Constructor for the NXTMMX

Parameters:
port - - the port its plugged in to
Method Detail

reset

public void reset()
resets mux values to default and stops all tasks. This includes zeroing the tachos.


isAutoStart

public boolean isAutoStart()
Determines if motors will automatically start or not. By default they are on.

Returns:
true if on

setAutoStart

public void setAutoStart(boolean autoStart)
Turns autostart on or off. if you are going to start the motors at same time, turn autostart off and use the motor methods in this class, not the individual motors.

Default at instantiation is true.

Parameters:
autoStart - true to enable autoStart

startMotors

public void startMotors()
Starts both motors at the same time. Speed has to be set and direction or tacho should be set on the motors.


fltMotors

public void fltMotors()
Floats both motors


stopMotors

public void stopMotors()
Stops both motors


getVoltage

public float getVoltage()
Returns the voltage supplied to the NXTMMX

Returns:
the voltage in volts