@Test public void setAngle() throws IOException { Servo servo = new Servo(mPwm); servo.setAngleRange(0, 180); servo.setAngle(90); assertEquals(90, servo.getAngle(), EPSILON); }
public void setAngle(double angle) throws IOException { if (angle < mMinAngle || angle > mMaxAngle) { throw new IllegalArgumentException("angle (" + angle + ") not in range [" + mMinAngle + ", " + mMaxAngle + "]"); } mAngle = angle; updateDutyCycle(); }
Servo implements AutoCloseable { public void setAngle(double angle) throws IOException { if (angle < mMinAngle || angle > mMaxAngle) { throw new IllegalArgumentException("angle (" + angle + ") not in range [" + mMinAngle + ", " + mMaxAngle + "]"); } mAngle = angle; updateDutyCycle(); } }
Servo implements AutoCloseable { public void setAngle(double angle) throws IOException { if (angle < mMinAngle || angle > mMaxAngle) { throw new IllegalArgumentException("angle (" + angle + ") not in range [" + mMinAngle + ", " + mMaxAngle + "]"); } mAngle = angle; updateDutyCycle(); } Servo(String pin);  Servo(String pin, double frequencyHz); @VisibleForTesting  Servo(Pwm device); @VisibleForTesting  Servo(Pwm device, double frequencyHz); }
Servo implements AutoCloseable { public void setAngle(double angle) throws IOException { if (angle < mMinAngle || angle > mMaxAngle) { throw new IllegalArgumentException("angle (" + angle + ") not in range [" + mMinAngle + ", " + mMaxAngle + "]"); } mAngle = angle; updateDutyCycle(); } Servo(String pin);  Servo(String pin, double frequencyHz); @VisibleForTesting  Servo(Pwm device); @VisibleForTesting  Servo(Pwm device, double frequencyHz); @Override void close(); void setEnabled(boolean enabled); void setPulseDurationRange(double minMs, double maxMs); double getMinimumPulseDuration(); double getMaximumPulseDuration(); void setAngleRange(double minAngle, double maxAngle); double getMinimumAngle(); double getMaximumAngle(); void setAngle(double angle); double getAngle(); }
Servo implements AutoCloseable { public void setAngle(double angle) throws IOException { if (angle < mMinAngle || angle > mMaxAngle) { throw new IllegalArgumentException("angle (" + angle + ") not in range [" + mMinAngle + ", " + mMaxAngle + "]"); } mAngle = angle; updateDutyCycle(); } Servo(String pin);  Servo(String pin, double frequencyHz); @VisibleForTesting  Servo(Pwm device); @VisibleForTesting  Servo(Pwm device, double frequencyHz); @Override void close(); void setEnabled(boolean enabled); void setPulseDurationRange(double minMs, double maxMs); double getMinimumPulseDuration(); double getMaximumPulseDuration(); void setAngleRange(double minAngle, double maxAngle); double getMinimumAngle(); double getMaximumAngle(); void setAngle(double angle); double getAngle(); static final double DEFAULT_FREQUENCY_HZ; }