com.dexterind.gopigo.components
Class Motor

java.lang.Object
  extended by com.dexterind.gopigo.components.Motor

public class Motor
extends java.lang.Object

Handles the motor functions.

Author:
marcello

Field Summary
static int BACKWARD
          The backward command.
private static Board board
          The main object which handles the methods to get access to the resources connected to the board.
private  int command
          The current command.
private  Debug debug
          The debug object.
static int FORWARD
          The forward command.
static int LEFT
          The left motor ID.
private static int LEFT_COMMAND
          The left motor command.
static int RIGHT
          The right motor ID.
private static int RIGHT_COMMAND
          The right motor command.
 
Constructor Summary
Motor(int id)
           
 
Method Summary
 int move(int direction, int speed)
          Moves the motor in the direction at the given speed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT_COMMAND

private static final int LEFT_COMMAND
The left motor command.

See Also:
Constant Field Values

RIGHT_COMMAND

private static final int RIGHT_COMMAND
The right motor command.

See Also:
Constant Field Values

FORWARD

public static final int FORWARD
The forward command.

See Also:
Constant Field Values

BACKWARD

public static final int BACKWARD
The backward command.

See Also:
Constant Field Values

LEFT

public static final int LEFT
The left motor ID.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
The right motor ID.

See Also:
Constant Field Values

board

private static Board board
The main object which handles the methods to get access to the resources connected to the board.


command

private int command
The current command.


debug

private Debug debug
The debug object.

Constructor Detail

Motor

public Motor(int id)
      throws java.io.IOException,
             java.lang.InterruptedException
Throws:
java.io.IOException
java.lang.InterruptedException
Method Detail

move

public int move(int direction,
                int speed)
         throws java.io.IOException
Moves the motor in the direction at the given speed.

Parameters:
direction - The direction of the movement.
speed -
Returns:
A status code.
Throws:
java.io.IOException