Skip to content

change default servo pulse range from 1000-2000 to 550-2400 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions adafruit_motor/servo.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class _BaseServo: # pylint: disable-msg=too-few-public-methods
:param ~pulseio.PWMOut pwm_out: PWM output object.
:param int min_pulse: The minimum pulse length of the servo in microseconds.
:param int max_pulse: The maximum pulse length of the servo in microseconds."""
def __init__(self, pwm_out, *, min_pulse=1000, max_pulse=2000):
def __init__(self, pwm_out, *, min_pulse=550, max_pulse=2400):
self._min_duty = int((min_pulse * pwm_out.frequency) / 1000000 * 0xffff)
max_duty = (max_pulse * pwm_out.frequency) / 1000000 * 0xffff
self._duty_range = int(max_duty - self._min_duty)
Expand All @@ -64,7 +64,7 @@ class Servo(_BaseServo):
duty in degrees.
:param int min_pulse: The minimum pulse length of the servo in microseconds.
:param int max_pulse: The maximum pulse length of the servo in microseconds."""
def __init__(self, pwm_out, *, actuation_range=180, min_pulse=1000, max_pulse=2000):
def __init__(self, pwm_out, *, actuation_range=180, min_pulse=550, max_pulse=2400):
super().__init__(pwm_out, min_pulse=min_pulse, max_pulse=max_pulse)
self._actuation_range = actuation_range
self._pwm = pwm_out
Expand Down
4 changes: 2 additions & 2 deletions examples/continuous_servo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
# pca = PCA9685(i2c, reference_clock_speed=25630710)
pca.frequency = 50

# The pulse range is 1000 - 2000 by default.
# The pulse range is 550 - 2400 by default.
servo7 = servo.ContinuousServo(pca.channels[7])
# If your servo doesn't stop once the script is finished you may need to tune the
# reference_clock_speed above or the min_pulse and max_pulse timings below.
# servo7 = servo.ContinuousServo(pca.channels[7], min_pulse=1000, max_pulse=2000)
# servo7 = servo.ContinuousServo(pca.channels[7], min_pulse=550, max_pulse=2400)

print("Forwards")
servo7.throttle = 1
Expand Down
2 changes: 1 addition & 1 deletion examples/servo_sweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# This is an example for the Micro servo - TowerPro SG-92R: https://www.adafruit.com/product/169
# servo7 = servo.Servo(pca.channels[7], min_pulse=500, max_pulse=2400)

# The pulse range is 1000 - 2000 by default.
# The pulse range is 550 - 2400 by default.
servo7 = servo.Servo(pca.channels[7])

# We sleep in the loops to give the servo time to move into position.
Expand Down