@Test public void setMotorSpeed() throws IOException { final int speed = 100; final int speedCheck = speed << 4; mDriver.setMotorSpeed(0, speed); verifyPin(8, 0, speedCheck); mDriver.setMotorSpeed(1, speed); verifyPin(13, 0, speedCheck); mDriver.setMotorSpeed(2, speed); verifyPin(2, 0, speedCheck); mDriver.setMotorSpeed(3, speed); verifyPin(7, 0, speedCheck); }
public void setMotorSpeed(int motor, int speed) throws IOException { if (mI2cDevice == null) { throw new IllegalStateException("I2C device not open"); } mMotors[motor].setSpeed(speed); }
MotorHat implements AutoCloseable { public void setMotorSpeed(int motor, int speed) throws IOException { if (mI2cDevice == null) { throw new IllegalStateException("I2C device not open"); } mMotors[motor].setSpeed(speed); } }
MotorHat implements AutoCloseable { public void setMotorSpeed(int motor, int speed) throws IOException { if (mI2cDevice == null) { throw new IllegalStateException("I2C device not open"); } mMotors[motor].setSpeed(speed); } MotorHat(String i2cBusName);  MotorHat(String i2cBusName, int i2cAddress); @VisibleForTesting  MotorHat(I2cDevice device); }
MotorHat implements AutoCloseable { public void setMotorSpeed(int motor, int speed) throws IOException { if (mI2cDevice == null) { throw new IllegalStateException("I2C device not open"); } mMotors[motor].setSpeed(speed); } MotorHat(String i2cBusName);  MotorHat(String i2cBusName, int i2cAddress); @VisibleForTesting  MotorHat(I2cDevice device); @Override void close(); void setMotorSpeed(int motor, int speed); void setMotorState(int motor, @MotorState int state); }
MotorHat implements AutoCloseable { public void setMotorSpeed(int motor, int speed) throws IOException { if (mI2cDevice == null) { throw new IllegalStateException("I2C device not open"); } mMotors[motor].setSpeed(speed); } MotorHat(String i2cBusName);  MotorHat(String i2cBusName, int i2cAddress); @VisibleForTesting  MotorHat(I2cDevice device); @Override void close(); void setMotorSpeed(int motor, int speed); void setMotorState(int motor, @MotorState int state); static final int DEFAULT_I2C_ADDRESS; static final int MOTOR_STATE_RELEASE; static final int MOTOR_STATE_CW; static final int MOTOR_STATE_CCW; }