jBotBrain.hw
Class Motor

java.lang.Object
  extended by jBotBrain.hw.Motor

public class Motor
extends Object

Motor abstraction class. Usage:

 Motor.A.setSpeed(200);
 Motor.A.setDirection(Motor.MOTOR_FORWARD);
 Motor.B.setSpeed(50);
 Motor.B.setDirection(Motor.MOTOR_BACKWARD);

Author:
Martin Wolf

Field Summary
static Motor A
          1st motor
static Motor B
          2nd motor
static int MOTOR_BACKWARD
          Backward direction
static int MOTOR_FORWARD
          Forward direction
 
Method Summary
 int getMotorCurrent()
          Get motor current
 void setDirection(int direction)
          Set movement direction of motor
 void setSpeed(int speed)
          Set motor speed
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Field Detail

A

public static final Motor A
1st motor


B

public static final Motor B
2nd motor


MOTOR_FORWARD

public static final int MOTOR_FORWARD
Forward direction

See Also:
Constant Field Values

MOTOR_BACKWARD

public static final int MOTOR_BACKWARD
Backward direction

See Also:
Constant Field Values
Method Detail

setSpeed

public void setSpeed(int speed)
Set motor speed

Parameters:
speed - - Motor speed in range from 0 to 255

setDirection

public void setDirection(int direction)
Set movement direction of motor

Parameters:
time - - Motor direction
See Also:
MOTOR_FORWARD, MOTOR_BACKWARD

getMotorCurrent

public int getMotorCurrent()
Get motor current

Returns:
Motor current in mA