Skip to content

Allow specifying the PCA frequency #21

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 2 commits into from
Jul 14, 2020
Merged
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
12 changes: 10 additions & 2 deletions adafruit_servokit.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,19 @@ class ServoKit:
:param int address: The I2C address of the PCA9685. Default address is ``0x40``.
:param int reference_clock_speed: The frequency of the internal reference clock in Hertz.
Default reference clock speed is ``25000000``.
:param int frequency: The overall PWM frequency of the PCA9685 in Hertz.
Default frequency is ``50``.

"""

def __init__(
self, *, channels, i2c=None, address=0x40, reference_clock_speed=25000000
self,
*,
channels,
i2c=None,
address=0x40,
reference_clock_speed=25000000,
frequency=50
):
if channels not in [8, 16]:
raise ValueError("servo_channels must be 8 or 16!")
Expand All @@ -89,7 +97,7 @@ def __init__(
self._pca = PCA9685(
i2c, address=address, reference_clock_speed=reference_clock_speed
)
self._pca.frequency = 50
self._pca.frequency = frequency

self._servo = _Servo(self)
self._continuous_servo = _ContinuousServo(self)
Expand Down