diff --git a/adafruit_motor/stepper.py b/adafruit_motor/stepper.py index 1c29ee8..3100d34 100755 --- a/adafruit_motor/stepper.py +++ b/adafruit_motor/stepper.py @@ -114,12 +114,13 @@ def __init__( self._coil = (ain2, bin1, ain1, bin2) for i in range(4): if self._coil[i].frequency < 1500: - if not self._coil[i].variable_frequency: + try: + self._coil[i].frequency = 2000 + except AttributeError as err: raise ValueError( "PWMOut outputs must either be set to at least " "1500 Hz or allow variable frequency." - ) - self._coil[i].frequency = 2000 + ) from err if microsteps < 2: raise ValueError("Microsteps must be at least 2") if microsteps % 2 == 1: