lejos.nxt
Class NXTMotor

java.lang.Object
  extended by lejos.nxt.BasicMotor
      extended by lejos.nxt.NXTMotor
All Implemented Interfaces:
BaseMotor, DCMotor, Encoder, EncoderMotor
Direct Known Subclasses:
DSwitch

public class NXTMotor
extends BasicMotor
implements EncoderMotor

Abstraction for an NXT motor with no speed regulation.


Field Summary
protected  Encoder encoderPort
           
 
Fields inherited from class lejos.nxt.BasicMotor
INVALID_MODE, mode, port, power
 
Constructor Summary
NXTMotor(TachoMotorPort port)
          Create an instance of a NXTMotor using the specified motor port the PWM operating mode will be PWM_BREAK BasicMotorPort.PWM_BRAKE
NXTMotor(TachoMotorPort port, int PWMMode)
          Create an instance of a NXTMotor using the specified motor port and PWM operating mode.
 
Method Summary
 int getTachoCount()
          Returns the tachometer count.
 void resetTachoCount()
          Reset the tachometer count.
 
Methods inherited from class lejos.nxt.BasicMotor
backward, flt, forward, getPower, isMoving, setPower, stop, updateState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface lejos.robotics.DCMotor
getPower, setPower
 
Methods inherited from interface lejos.robotics.BaseMotor
backward, flt, forward, isMoving, stop
 

Field Detail

encoderPort

protected Encoder encoderPort
Constructor Detail

NXTMotor

public NXTMotor(TachoMotorPort port,
                int PWMMode)
Create an instance of a NXTMotor using the specified motor port and PWM operating mode.

Parameters:
port - The motor port that the motor will be attached to.
PWMMode - see BasicMotorPort.PWM_FLOAT and see BasicMotorPort.PWM_BRAKE

NXTMotor

public NXTMotor(TachoMotorPort port)
Create an instance of a NXTMotor using the specified motor port the PWM operating mode will be PWM_BREAK BasicMotorPort.PWM_BRAKE

Parameters:
port - The motor port that the motor will be attached to.
Method Detail

getTachoCount

public int getTachoCount()
Description copied from interface: Encoder
Returns the tachometer count.

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

resetTachoCount

public void resetTachoCount()
Description copied from interface: Encoder
Reset the tachometer count.

Specified by:
resetTachoCount in interface Encoder