Skip to content

Commit ec13af8

Browse files
authored
Merge pull request #17 from kattni/i2c-fix
Fixing I2C init issue.
2 parents f19e2b5 + ea04294 commit ec13af8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

adafruit_motorkit.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,27 @@
5151
5252
"""
5353

54-
# imports
55-
56-
__version__ = "0.0.0-auto.0"
57-
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MotorKit.git"
5854

5955
import board
60-
import busio
6156
from adafruit_pca9685 import PCA9685
6257

58+
__version__ = "0.0.0-auto.0"
59+
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MotorKit.git"
60+
6361

6462
class MotorKit:
6563
"""Class representing an Adafruit DC & Stepper Motor FeatherWing, Shield or Pi Hat kit.
6664
6765
Automatically uses the I2C bus on a Feather, Metro or Raspberry Pi."""
68-
def __init__(self, address=0x60):
66+
def __init__(self, address=0x60, i2c=None):
6967
self._motor1 = None
7068
self._motor2 = None
7169
self._motor3 = None
7270
self._motor4 = None
7371
self._stepper1 = None
7472
self._stepper2 = None
75-
i2c = busio.I2C(board.SCL, board.SDA)
73+
if i2c is None:
74+
i2c = board.I2C()
7675
self._pca = PCA9685(i2c, address=address)
7776
self._pca.frequency = 1600
7877

0 commit comments

Comments
 (0)