|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object josx.platform.rcx.Motor
Abstraction for a motor. Three instances of Motor
are available: Motor.A
, Motor.B
and Motor.C
. To control each motor use
methods forward, backward, reverseDirection, stop
and flt
. To set each motor's power, use
setPower
.
Example:
Motor.A.setPower(1);
Motor.C.setPower(7);
Motor.A.forward();
Motor.C.forward();
Thread.sleep (1000);
Motor.A.stop();
Motor.C.stop();
Field Summary | |
static Motor |
A
Motor A. |
static Motor |
B
Motor B. |
static Motor |
C
Motor C. |
Method Summary | |
void |
backward()
Causes motor to rotate backwards. |
static void |
controlMotor(char aMotor,
int aMode,
int aPower)
Deprecated. I've decided to remove this method. If you really need it, check its implementation in classes/josx/platform/rcx/Motor.java. |
void |
flt()
Causes motor to float. |
void |
forward()
Causes motor to rotate forward. |
char |
getId()
Get the ID of the motor. |
int |
getPower()
Returns the current motor power. |
boolean |
isBackward()
Return true if motor is backward. |
boolean |
isFloating()
|
boolean |
isForward()
Return true if motor is forward. |
boolean |
isMoving()
|
boolean |
isStopped()
Return true if motor is stopped. |
void |
reverseDirection()
Reverses direction of the motor. |
void |
setPower(int aPower)
Sets motor power to a value between 0 and 7. |
void |
stop()
Causes motor to stop, pretty much instantaneously. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait |
Field Detail |
public static final Motor A
public static final Motor B
public static final Motor C
Method Detail |
public final char getId()
public final void setPower(int aPower)
public final void forward()
public final boolean isForward()
public final void backward()
public final boolean isBackward()
public final void reverseDirection()
public final int getPower()
public final boolean isMoving()
public final boolean isFloating()
public final void stop()
public final boolean isStopped()
public final void flt()
public static void controlMotor(char aMotor, int aMode, int aPower)
aMotor
- The motor id: 'A', 'B' or 'C'.aMode
- 1=forward, 2=backward, 3=stop, 4=floataPower
- A value in the range [0-7].
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |