public class MMXMotor extends java.lang.Object implements EncoderMotor
Use the NXTMMX.getBasicMotor()
factory method to retrieve an instance of this class.
NXTMMX
,
MMXRegulatedMotor
Modifier and Type | Method and Description |
---|---|
void |
backward()
Causes motor to rotate backwards until
stop() or flt() is called. |
void |
flt()
Motor loses all power, causing the rotor to float freely to a stop.
|
void |
forward()
Causes motor to rotate forward until
stop() or flt() is called. |
int |
getPower()
Returns the current motor power setting.
|
int |
getTachoCount()
Returns the tachometer count.
|
boolean |
isMoving()
Return
true if the motor is moving. |
void |
resetTachoCount()
Reset the the tachometer count.
|
void |
setPower(int power)
Set the power level 0%-100% to be applied to the motor
|
void |
setRamping(boolean doRamping)
Sets speed ramping is enabled/disabled for this motor.
|
void |
setRegulate(boolean regulate)
Disable or Enable internal motor controller speed regulation.
|
void |
stop()
Causes motor to stop immediately.
|
public void setPower(int power)
DCMotor
public void setRamping(boolean doRamping)
doRamping
- true
to enable, false
to disablepublic int getPower()
DCMotor
public void forward()
BaseMotor
stop()
or flt()
is called.public void backward()
BaseMotor
stop()
or flt()
is called.public void stop()
BaseMotor
public void flt()
BaseMotor
public boolean isMoving()
true
if the motor is moving. Note that this method reports based on the current control
state (i.e. commanded to move) and not if the motor is actually moving. This means a motor may be stalled but this
method would return true
.public int getTachoCount()
Encoder
getTachoCount
in interface Encoder
public void resetTachoCount()
resetTachoCount
in interface Encoder
public void setRegulate(boolean regulate)
true
will cause
the motor controller firmware to adjust the motor power to compensate for changing loads in order to maintain
a constant motor speed. Default at instantiation is false
.regulate
- true
to enable regulation, true
otherwise.