Class NXTMMX

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, SensorConstants, SensorMode, SensorModes, SampleProvider

    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 and use the factory methods to provide a MMXRegulatedMotor or MMXMotor instance.

    Author:
    Kirk P Thompsonn
    See Also:
    MMXRegulatedMotor, MMXMotor
    • Field Detail

      • MOTOR_M1

        public static final int MOTOR_M1
        Represents Motor 1 as indicated on the controller
        See Also:
        Constant Field Values
      • MOTOR_M2

        public static final int MOTOR_M2
        Represents Motor 2 as indicated on the controller
        See Also:
        Constant Field Values
      • DEFAULT_MMX_ADDRESS

        public static final int DEFAULT_MMX_ADDRESS
        The default I2C address (0x06) for the NXTMMX.
        See Also:
        Constant Field Values
    • Constructor Detail

      • NXTMMX

        public NXTMMX​(I2CPort port)
        Constructor for the NXTMMX
        Parameters:
        port - - the port its plugged in to
      • NXTMMX

        public NXTMMX​(Port port)
        Constructor for the NXTMMX
        Parameters:
        port - - the port its plugged in to
      • NXTMMX

        public NXTMMX​(I2CPort port,
                      int address)
        Constructor for the NXTMMX
        Parameters:
        port - - the sensor port its plugged in to
        address - The I2C address for the device
      • NXTMMX

        public NXTMMX​(Port port,
                      int address)
        Constructor for the NXTMMX
        Parameters:
        port - - the sensor port its plugged in to
        address - The I2C address for the device
    • Method Detail

      • getRegulatedMotor

        public MMXRegulatedMotor getRegulatedMotor​(int motorID)
        Get a MMXRegulatedMotor instance that is associated with the motorID.
        Parameters:
        motorID - The motor ID number. This is indicated on the NXTMMX Motor Controller and is represented using MOTOR_M1 or MOTOR_M2.
        Returns:
        The MMXRegulatedMotor instance
        Throws:
        java.lang.IllegalArgumentException - if invalid motorID
        java.lang.UnsupportedOperationException - if motorID has already been used for a MMXMotor motor instance.
        See Also:
        MMXRegulatedMotor, getBasicMotor(int)
      • getBasicMotor

        public MMXMotor getBasicMotor​(int motorID)
        Get a MMXMotor instance that is associated with the motorID.
        Parameters:
        motorID - The motor ID number. This is indicated on the NXTMMX Motor Controller and is represented using MOTOR_M1 or MOTOR_M2.
        Returns:
        The MMXMotor instance
        Throws:
        java.lang.IllegalArgumentException - if invalid motorID
        java.lang.UnsupportedOperationException - if motorID has already been used for a MMXRegulatedMotor motor instance.
        See Also:
        MMXMotor, getRegulatedMotor(int)
      • getVoltage

        public float getVoltage()
        Returns the voltage supplied to the NXTMMX
        Returns:
        the voltage in volts
      • stopMotors

        public void stopMotors()
        Synchronized stop both motors
      • fltMotors

        public void fltMotors()
        Synchronized Float both motors