|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.nxt.addon.MMXMotor
public class MMXMotor
Abstraction to drive a basic encoder motor with the NXTMMX motor multiplexer. The NXTMMX motor multiplexer device allows you to connect two additional motors to your robot using a sensor port. Multiple NXTMMXs can be chained together.
Create an instance of this class passing a NXTMMX
instance and Motor ID
(
or MMX_MOTOR_1
)
in the constructor.
MMX_MOTOR_2
NXTMMX
,
MMXRegulatedMotor
Constructor Summary | |
---|---|
MMXMotor(NXTMMX mux,
int motor)
Create an instance of a MMXMotor . |
Method Summary | |
---|---|
void |
backward()
Causes motor to rotate backwards. |
void |
flt()
Causes motor to float. |
void |
forward()
Causes motor to rotate forward. |
int |
getPower()
Returns the current motor power setting. |
int |
getTachoCount()
Returns the tachometer count. |
boolean |
isMoving()
This method returns true if the motor has been commanded with the forward() or
backward() methods. |
void |
resetTachoCount()
Resets the tachometer count to zero. |
void |
setPower(int power)
Set the power level 0-100% to be applied to the motor. |
void |
stop()
Causes motor to stop pretty much instantaneously. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MMXMotor(NXTMMX mux, int motor)
MMXMotor
.
mux
- the motor multiplexor NXTMMX
instance to bind this motor to.motor
- the index of the motor connected to the NXTMMX: NXTMMX.MMX_MOTOR_1
or NXTMMX.MMX_MOTOR_2
NXTMMX
,
NXTMMX.MMX_MOTOR_1
,
NXTMMX.MMX_MOTOR_2
Method Detail |
---|
public void setPower(int power)
setPower
in interface DCMotor
power
- new motor power 0-100%getPower()
public int getPower()
getPower
in interface DCMotor
setPower(int)
public void forward()
forward
in interface BaseMotor
backward()
public void backward()
backward
in interface BaseMotor
forward()
public void flt()
flt
in interface BaseMotor
public void stop()
stop
in interface BaseMotor
public int getTachoCount()
getTachoCount
in interface Encoder
resetTachoCount()
public void resetTachoCount()
resetTachoCount
in interface Encoder
getTachoCount()
public boolean isMoving()
true
if the motor has been commanded with the forward()
or
backward()
methods.
isMoving
in interface BaseMotor
true
if the motor has been commanded to move, false
otherwise.flt()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |