@@ -63,7 +63,7 @@ class MotorKit:
6363 """Class representing an Adafruit DC & Stepper Motor FeatherWing, Shield or Pi Hat kit.
6464
6565 Automatically uses the I2C bus on a Feather, Metro or Raspberry Pi."""
66- def __init__ (self , address = 0x60 , i2c = None ):
66+ def __init__ (self , address = 0x60 , i2c = None , steppers_microsteps = 16 ):
6767 self ._motor1 = None
6868 self ._motor2 = None
6969 self ._motor3 = None
@@ -74,6 +74,7 @@ def __init__(self, address=0x60, i2c=None):
7474 i2c = board .I2C ()
7575 self ._pca = PCA9685 (i2c , address = address )
7676 self ._pca .frequency = 1600
77+ self ._steppers_microsteps = steppers_microsteps
7778
7879 # We can save memory usage (~300 bytes) by deduplicating the construction of the objects for
7980 # each motor. This saves both code size and the number of raw strings (the error message)
@@ -227,7 +228,8 @@ def stepper1(self):
227228 self ._pca .channels [8 ].duty_cycle = 0xffff
228229 self ._pca .channels [13 ].duty_cycle = 0xffff
229230 self ._stepper1 = stepper .StepperMotor (self ._pca .channels [10 ], self ._pca .channels [9 ],
230- self ._pca .channels [11 ], self ._pca .channels [12 ])
231+ self ._pca .channels [11 ], self ._pca .channels [12 ],
232+ microsteps = self ._steppers_microsteps )
231233 return self ._stepper1
232234
233235 @property
@@ -261,5 +263,6 @@ def stepper2(self):
261263 self ._pca .channels [7 ].duty_cycle = 0xffff
262264 self ._pca .channels [2 ].duty_cycle = 0xffff
263265 self ._stepper2 = stepper .StepperMotor (self ._pca .channels [4 ], self ._pca .channels [3 ],
264- self ._pca .channels [5 ], self ._pca .channels [6 ])
266+ self ._pca .channels [5 ], self ._pca .channels [6 ],
267+ microsteps = self ._steppers_microsteps )
265268 return self ._stepper2
0 commit comments