lejos.nxt
Class Motor

java.lang.Object
  extended by lejos.nxt.Motor

public class Motor
extends Object

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);
 

Author:
Roger Glassey/Andy Shaw

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

A

public static final NXTRegulatedMotor A
Motor A.


B

public static final NXTRegulatedMotor B
Motor B.


C

public static final NXTRegulatedMotor C
Motor C.

Method Detail

getInstance

public static NXTRegulatedMotor getInstance(int id)
Return the Motor with the given Id.

Parameters:
id - the Id, between 0 and MotorPort.NUMBER_OF_PORTS-1.
Returns:
the MotorPort object