Skip to content

Fixing I2C issue. #6

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
Mar 19, 2019
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
6 changes: 3 additions & 3 deletions adafruit_servokit.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"""

import board
import busio
from adafruit_pca9685 import PCA9685

__version__ = "0.0.0-auto.0"
Expand All @@ -77,12 +76,13 @@ class ServoKit:
Default reference clock speed is ``25000000``.

"""
def __init__(self, *, channels, address=0x40, reference_clock_speed=25000000):
def __init__(self, *, channels, i2c=None, address=0x40, reference_clock_speed=25000000):
if channels not in [8, 16]:
raise ValueError("servo_channels must be 8 or 16!")
self._items = [None] * channels
self._channels = channels
i2c = busio.I2C(board.SCL, board.SDA)
if i2c is None:
i2c = board.I2C()
self._pca = PCA9685(i2c, address=address, reference_clock_speed=reference_clock_speed)
self._pca.frequency = 50

Expand Down