Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## lejos.nxt
Class BasicMotor

    java.lang.Object
      lejos.nxt.BasicMotor

Direct Known Subclasses:
  Motor, RCXMotor

    public abstract class BasicMotor

extends Object

An abstraction for a motor without a tachometer, such as an RCX motor.

Author:
  Lawrie Griffiths

Constructor Summary
`BasicMotor()`

Method Summary
`void` | `backward()` Causes motor to rotate backwards.
`void` | `flt()` Causes motor to float.
`void` | `forward()` Causes motor to rotate forward.
`int` | `getMode()` Returns the mode.
`int` | `getPower()` Returns the current power setting.
`boolean` | `isBackward()` Return true if motor is backward.
`boolean` | `isFloating()` Returns true iff the motor is in float mode.
`boolean` | `isForward()` Return true if motor is forward.
`boolean` | `isMoving()` Returns true iff the motor is in motion.
`boolean` | `isStopped()` Return true if motor is stopped.
`void` | `reverseDirection()` Reverses direction of the motor.
`void` | `setPower(int power)` Sets power.
`void` | `stop()` Causes motor to stop, pretty much instantaneously.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait`

Constructor Detail

### BasicMotor

    public BasicMotor()

Method Detail

### setPower

    public void setPower(int power)

  Sets power.

  Parameters:
    `power` - power setting: 0 - 100

### getPower

    public int getPower()

  Returns the current power setting.

  Returns:
    power value 0-100

### forward

    public void forward()

  Causes motor to rotate forward.

### isForward

    public boolean isForward()

  Return true if motor is forward.

### backward

    public void backward()

  Causes motor to rotate backwards.

### isBackward

    public boolean isBackward()

  Return true if motor is backward.

### reverseDirection

    public void reverseDirection()

  Reverses direction of the motor. It only has effect if the motor is moving.

### isMoving

    public boolean isMoving()

  Returns true iff the motor is in motion.

  Returns:
    true iff the motor is currently in motion.

### flt

    public void flt()

  Causes motor to float. The motor will lose all power, but this is not the same as stopping. Use this method if you don't want your robot to trip in abrupt turns.

### isFloating

    public boolean isFloating()

  Returns true iff the motor is in float mode.

  Returns:
    true iff the motor is currently in float mode.

### stop

    public void stop()

  Causes motor to stop, pretty much instantaneously. In other words, the motor doesn't just stop; it will resist any further motion. Cancels any rotate() orders in progress

### isStopped

    public boolean isStopped()

  Return true if motor is stopped.

### getMode

    public int getMode()

  Returns the mode.

  Returns:
    mode 1=forward, 2=backward, 3=stopped, 4=floating

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD