jBotBrain.devices
Class MD22

java.lang.Object
  extended by jBotBrain.devices.MD22

public class MD22
extends Object

MD-22 Dual 50Volt 5Amp H Bridge Motor Drive abstraction class.
Complete documentation can be found at MD-22 Technical documentation.

NOTE: This class is not static, it must be allocated.

Author:
Martin Wolf

Constructor Summary
MD22(int address)
          Constructor, set the device address on I2C bus.
 
Method Summary
 void setMode(byte mode)
          Set MD-22 mode.
 void setSpeed(byte motor1, byte motor2)
          Sets speed value of motors.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Constructor Detail

MD22

public MD22(int address)
Constructor, set the device address on I2C bus.

Method Detail

setMode

public void setMode(byte mode)
Set MD-22 mode. Parameter mode can be one of following:
0 - (Default Setting) If a value of 0 is written to the mode register then the meaning of the speed registers is literal speeds in the range of:
      0 (Full Reverse) 128 (Stop) 255 (Full Forward).
1 - Mode 1 is similar to Mode 0, except that the speed registers are interpreted as signed values. The meaning of the speed registers is literal speeds in the range of:
      -128 (Full Reverse) 0 (Stop) 127 (Full Forward).
2 - Writing a value of 2 to the mode register will make speed control both motors speed. Speed2 then becomes the turn value (type 1).
      Data is in the range of 0 (Full Reverse) 128 (Stop) 255 (Full Forward).
      note - version 8+ speed controls the total power, the turn (speed 2) value is now with reference to this.
3 - Mode 3 is similar to Mode 2, except that the speed registers are interpreted as signed values.
      Data is in the range of -128 (Full Reverse) 0 (Stop) 127 (Full Forward)
      note - version 8+ speed controls the total power, the turn (speed 2) value is now with reference to this.
4 - (New from version 9) Alternate method of turning (type 2), the turn value being able to introduce power to the system.
      Data is in the range of 0 (Full Reverse) 128 (Stop) 255 (Full Forward).
5 - (New from version 9) Alternate method of turning (type 2), the turn value being able to introduce power to the system.
      Data is in the range of -128 (Full Reverse) 0 (Stop) 127 (Full Forward)


setSpeed

public void setSpeed(byte motor1,
                     byte motor2)
Sets speed value of motors. Detailed information about motor speed values are described in function SetMode.

See Also:
cbox.devices.MD22.SetMode