We've written a handy CircuitPython library for the DC Motor and Stepper Pi Hat Kit called Adafruit CircuitPython MotorKit that handles all the complicated setup for you. All you need to do is import the appropriate class from the library, and then all the features of that class are available for use.
You can use this kit with a Raspberry Pi and Python thanks to Adafruit_Blinka, our CircuitPython-for-Python compatibility library.
The Adafruit DC and Stepper Motor Pi Hat kit uses I2C to communicate with your Raspberry Pi. You will have to make I2C support work on your Pi before you begin. Please visit our tutorial to enable I2C in the kernel!
You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. This will require enabling I2C on your Raspberry Pi and verifying you are running Python 3. Since Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready!
Once that's done, from your command line run the following command:
sudo pip3 install adafruit-circuitpython-motorkit
If your default Python is version 3 you may need to run
pip instead. Just make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!
This will install the Adafruit CircuitPython MotorKit library along with the necessary dependencies.