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 RCXMotor

    java.lang.Object
      lejos.nxt.RCXMotor

    public class RCXMotor

extends Object

Abstraction for an RCX motor.

Constructor Summary
`RCXMotor(lejos.nxt.BasicMotorPort port)`

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

### RCXMotor

    public RCXMotor(lejos.nxt.BasicMotorPort port)

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