adafruit / Adafruit_CircuitPython_MotorKit

CircuitPython helper library for the DC & Stepper Motor FeatherWing, Shield and Pi Hat kits.
MIT License
86 stars 31 forks source link

Zero Division Error #35

Closed jealford closed 3 years ago

jealford commented 3 years ago

Hi, We're using the Adafruit DC+Stepper Motor HAT and it is working fine until we attach an additional HAT (specifically this one). After attaching that HAT on top of the Adafruit one, and trying to run the example stepper code, we get this error:

File "/home/pi/.virtualenvs/plotter/lib/python3.7/site-packages/adafruit_pca9685.py", line 151, in frequency return self.reference_clock_speed / 4096 / self.prescale_reg ZeroDivisionError: float division by zero

The following code throws that error:

import time
import board
from adafruit_motorkit import MotorKit
from adafruit_motor import stepper

kit = MotorKit(i2c=board.I2C())

for i in range(500):
    print(kit.stepper1.onestep(style=stepper.DOUBLE))
    time.sleep(0.05)

kit.stepper1.release()

Any help would be greatly appreciated.

ladyada commented 3 years ago

it uses the same i2c address so you would have to change it on one of the hats. closing since it isn't a library issue. you can post in the forums for tech support