Package lejos.hardware.motor
Class UnregulatedMotor
- java.lang.Object
-
- lejos.hardware.Device
-
- lejos.hardware.motor.BasicMotor
-
- lejos.hardware.motor.UnregulatedMotor
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,BaseMotor,DCMotor,Encoder,EncoderMotor
public class UnregulatedMotor extends BasicMotor implements EncoderMotor
Abstraction for an NXT motor with no speed regulation.
-
-
Field Summary
Fields Modifier and Type Field Description protected EncoderencoderPort-
Fields inherited from class lejos.hardware.motor.BasicMotor
INVALID_MODE, mode, port, power
-
-
Constructor Summary
Constructors Constructor Description UnregulatedMotor(Port port)Create an instance of a NXTMotor using the specified motor port the PWM operating mode will be PWM_BREAKBasicMotorPort.PWM_BRAKEUnregulatedMotor(Port port, int PWMMode)Create an instance of a NXTMotor using the specified motor port and PWM operating mode.UnregulatedMotor(TachoMotorPort port)Create an instance of a NXTMotor using the specified motor port the PWM operating mode will be PWM_BREAKBasicMotorPort.PWM_BRAKEUnregulatedMotor(TachoMotorPort mport, int PWMMode)Create an instance of a NXTMotor using the specified motor port and PWM operating mode.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetTachoCount()Returns the tachometer count.voidresetTachoCount()Reset the tachometer count.-
Methods inherited from class lejos.hardware.motor.BasicMotor
backward, flt, forward, getPower, isMoving, setPower, stop, updateState
-
Methods inherited from class lejos.hardware.Device
close, releaseOnClose
-
-
-
-
Field Detail
-
encoderPort
protected Encoder encoderPort
-
-
Constructor Detail
-
UnregulatedMotor
public UnregulatedMotor(Port 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- seeBasicMotorPort.PWM_FLOATand seeBasicMotorPort.PWM_BRAKE
-
UnregulatedMotor
public UnregulatedMotor(Port port)
Create an instance of a NXTMotor using the specified motor port the PWM operating mode will be PWM_BREAKBasicMotorPort.PWM_BRAKE- Parameters:
port- The motor port that the motor will be attached to.
-
UnregulatedMotor
public UnregulatedMotor(TachoMotorPort mport, int PWMMode)
Create an instance of a NXTMotor using the specified motor port and PWM operating mode.- Parameters:
mport- The motor port that the motor will be attached to.PWMMode- seeBasicMotorPort.PWM_FLOATand seeBasicMotorPort.PWM_BRAKE
-
UnregulatedMotor
public UnregulatedMotor(TachoMotorPort port)
Create an instance of a NXTMotor using the specified motor port the PWM operating mode will be PWM_BREAKBasicMotorPort.PWM_BRAKE- Parameters:
port- The motor port that the motor will be attached to.
-
-
Method Detail
-
getTachoCount
public int getTachoCount()
Description copied from interface:EncoderReturns the tachometer count.- Specified by:
getTachoCountin interfaceEncoder- Returns:
- tachometer count in degrees
-
resetTachoCount
public void resetTachoCount()
Description copied from interface:EncoderReset the tachometer count.- Specified by:
resetTachoCountin interfaceEncoder
-
-