|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.nxt.addon.tetrix.TetrixMotor
public class TetrixMotor
Tetrix basic DC motor abstraction without encoder support. The default power at instantiation is 100%.
Use
to retrieve a TetrixMotorController.getBasicMotor(int)
TetrixMotor
instance.
Method Summary | |
---|---|
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. |
boolean |
isMoving()
Return true if the motor is moving. |
void |
setPower(int power)
Set the power level 0%-100% to be applied to the motor |
void |
setReverse(boolean reverse)
Used to alter the forward/reverse direction mapping for the motor output. |
void |
stop()
Causes motor to stop immediately. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void setPower(int power)
DCMotor
setPower
in interface DCMotor
power
- new motor power 0-100public int getPower()
DCMotor
getPower
in interface DCMotor
public void forward()
BaseMotor
stop()
or flt()
is called.
forward
in interface BaseMotor
public void backward()
BaseMotor
stop()
or flt()
is called.
backward
in interface BaseMotor
public void stop()
BaseMotor
stop
in interface BaseMotor
public void flt()
BaseMotor
flt
in interface 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
.
isMoving
in interface BaseMotor
true
if the motor is executing a movement command, false
if stopped.public void setReverse(boolean reverse)
Changes to this setting take effect on the next motor command.
reverse
- true
to reverse direction mapping for this motor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |