Skip to content

Commit 8539700

Browse files
committed
Allow specifying the PCA frequency
1 parent 558a0e9 commit 8539700

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

adafruit_servokit.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,13 @@ class ServoKit:
7474
:param int address: The I2C address of the PCA9685. Default address is ``0x40``.
7575
:param int reference_clock_speed: The frequency of the internal reference clock in Hertz.
7676
Default reference clock speed is ``25000000``.
77+
:param int frequency: The overall PWM frequency of the PCA9685 in Hertz.
78+
Default frequency is ``50``.
7779
7880
"""
7981

8082
def __init__(
81-
self, *, channels, i2c=None, address=0x40, reference_clock_speed=25000000
83+
self, *, channels, i2c=None, address=0x40, reference_clock_speed=25000000, frequency=50
8284
):
8385
if channels not in [8, 16]:
8486
raise ValueError("servo_channels must be 8 or 16!")
@@ -89,7 +91,7 @@ def __init__(
8991
self._pca = PCA9685(
9092
i2c, address=address, reference_clock_speed=reference_clock_speed
9193
)
92-
self._pca.frequency = 50
94+
self._pca.frequency = frequency
9395

9496
self._servo = _Servo(self)
9597
self._continuous_servo = _ContinuousServo(self)

0 commit comments

Comments
 (0)