|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.nxt.Motor
public class Motor
Motor class contains 3 instances of regulated motors.
Example:
Motor.A.setSpeed(720);// 2 RPM
Motor.C.setSpeed(720);
Motor.A.forward();
Motor.C.forward();
Thread.sleep (1000);
Motor.A.stop();
Motor.C.stop();
Motor.A.rotateTo( 360);
Motor.A.rotate(-720,true);
while(Motor.A.isMoving() :Thread.yield();
int angle = Motor.A.getTachoCount(); // should be -360
LCD.drawInt(angle,0,0);
Field Summary | |
---|---|
static NXTRegulatedMotor |
A
Motor A. |
static NXTRegulatedMotor |
B
Motor B. |
static NXTRegulatedMotor |
C
Motor C. |
Method Summary | |
---|---|
static NXTRegulatedMotor |
getInstance(int id)
Return the Motor with the given Id. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final NXTRegulatedMotor A
public static final NXTRegulatedMotor B
public static final NXTRegulatedMotor C
Method Detail |
---|
public static NXTRegulatedMotor getInstance(int id)
id
- the Id, between 0 and MotorPort.NUMBER_OF_PORTS
-1.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |