lejos.nxt
Class MotorPort

java.lang.Object
  extended by lejos.nxt.MotorPort
All Implemented Interfaces:
BasicMotorPort, TachoMotorPort, Encoder

public class MotorPort
extends Object
implements TachoMotorPort

Abstraction for a NXT output port.


Field Summary
static MotorPort A
          MotorPort A.
static MotorPort B
          MotorPort B.
static MotorPort C
          MotorPort C.
 
Fields inherited from interface lejos.nxt.BasicMotorPort
PWM_BRAKE, PWM_FLOAT
 
Method Summary
 void controlMotor(int power, int mode)
          Low-level method to control a motor.
 int getTachoCount()
          returns tachometer count
static int getTachoCountById(int aMotor)
           
 void resetTachoCount()
          resets the tachometer count to 0;
static void resetTachoCountById(int aMotor)
           
 void setPWMMode(int mode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

A

public static final MotorPort A
MotorPort A.


B

public static final MotorPort B
MotorPort B.


C

public static final MotorPort C
MotorPort C.

Method Detail

controlMotor

public void controlMotor(int power,
                         int mode)
Low-level method to control a motor.

Specified by:
controlMotor in interface BasicMotorPort
Parameters:
power - power from 0-100
mode - 1=forward, 2=backward, 3=stop, 4=float

getTachoCount

public int getTachoCount()
returns tachometer count

Specified by:
getTachoCount in interface Encoder
Returns:
tachometer count in degrees

getTachoCountById

public static int getTachoCountById(int aMotor)

resetTachoCount

public void resetTachoCount()
resets the tachometer count to 0;

Specified by:
resetTachoCount in interface Encoder

setPWMMode

public void setPWMMode(int mode)
Specified by:
setPWMMode in interface BasicMotorPort

resetTachoCountById

public static void resetTachoCountById(int aMotor)