|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.nxt.BasicMotor
public abstract class BasicMotor
Abstraction for basic motor operations.
Field Summary | |
---|---|
protected static int |
INVALID_MODE
|
protected int |
mode
|
protected BasicMotorPort |
port
|
protected int |
power
|
Constructor Summary | |
---|---|
BasicMotor()
|
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. |
boolean |
isMoving()
Returns true iff the motor is in motion. |
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. |
protected void |
updateState(int newMode)
Update the internal state tracking the motor direction |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static int INVALID_MODE
protected int mode
protected BasicMotorPort port
protected int power
Constructor Detail |
---|
public BasicMotor()
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
protected void updateState(int newMode)
newMode
- public void forward()
forward
in interface BaseMotor
public void backward()
backward
in interface BaseMotor
public boolean isMoving()
isMoving
in interface BaseMotor
public void flt()
flt
in interface BaseMotor
public void stop()
stop
in interface BaseMotor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |