@@ -63,7 +63,7 @@ class MotorKit:
63
63
"""Class representing an Adafruit DC & Stepper Motor FeatherWing, Shield or Pi Hat kit.
64
64
65
65
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 ):
67
67
self ._motor1 = None
68
68
self ._motor2 = None
69
69
self ._motor3 = None
@@ -74,6 +74,7 @@ def __init__(self, address=0x60, i2c=None):
74
74
i2c = board .I2C ()
75
75
self ._pca = PCA9685 (i2c , address = address )
76
76
self ._pca .frequency = 1600
77
+ self ._steppers_microsteps = steppers_microsteps
77
78
78
79
# We can save memory usage (~300 bytes) by deduplicating the construction of the objects for
79
80
# each motor. This saves both code size and the number of raw strings (the error message)
@@ -227,7 +228,8 @@ def stepper1(self):
227
228
self ._pca .channels [8 ].duty_cycle = 0xffff
228
229
self ._pca .channels [13 ].duty_cycle = 0xffff
229
230
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 )
231
233
return self ._stepper1
232
234
233
235
@property
@@ -261,5 +263,6 @@ def stepper2(self):
261
263
self ._pca .channels [7 ].duty_cycle = 0xffff
262
264
self ._pca .channels [2 ].duty_cycle = 0xffff
263
265
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 )
265
268
return self ._stepper2
0 commit comments