lejos.hardware.motor.Motor Maven / Gradle / Ivy
Show all versions of lejos-ev3-api Show documentation
package lejos.hardware.motor;
import lejos.hardware.BrickFinder;
/**
* 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
*/
public class Motor
{
/**
* Motor A.
*/
public static final NXTRegulatedMotor A = new NXTRegulatedMotor(BrickFinder.getDefault().getPort("A"));
/**
* Motor B.
*/
public static final NXTRegulatedMotor B = new NXTRegulatedMotor(BrickFinder.getDefault().getPort("B"));
/**
* Motor C.
*/
public static final NXTRegulatedMotor C = new NXTRegulatedMotor(BrickFinder.getDefault().getPort("C"));
/**
* Motor D.
*/
public static final NXTRegulatedMotor D = new NXTRegulatedMotor(BrickFinder.getDefault().getPort("D"));
private Motor() {
// Motor class cannot be instantiated
}
}