|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectlejos.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 DCMotorpower - new motor power 0-100public int getPower()
DCMotor
getPower in interface DCMotorprotected void updateState(int newMode)
newMode - public void forward()
forward in interface BaseMotorpublic void backward()
backward in interface BaseMotorpublic boolean isMoving()
isMoving in interface BaseMotorpublic void flt()
flt in interface BaseMotorpublic void stop()
stop in interface BaseMotor
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||