Skip to content

Commit 4c36fa4

Browse files
authored
Merge pull request #70 from makermelissa/master
Fix error caused by non-existent variable_frequency property
2 parents c71b9e4 + 5a3cc7c commit 4c36fa4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

adafruit_motor/stepper.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,13 @@ def __init__(
114114
self._coil = (ain2, bin1, ain1, bin2)
115115
for i in range(4):
116116
if self._coil[i].frequency < 1500:
117-
if not self._coil[i].variable_frequency:
117+
try:
118+
self._coil[i].frequency = 2000
119+
except AttributeError as err:
118120
raise ValueError(
119121
"PWMOut outputs must either be set to at least "
120122
"1500 Hz or allow variable frequency."
121-
)
122-
self._coil[i].frequency = 2000
123+
) from err
123124
if microsteps < 2:
124125
raise ValueError("Microsteps must be at least 2")
125126
if microsteps % 2 == 1:

0 commit comments

Comments
 (0)