Python Forum
Arduino Code to Python Code - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: Arduino Code to Python Code (/thread-35915.html)



Arduino Code to Python Code - boogeyman1 - Dec-29-2021

Hello,

I am working on integrating a GUI with some Arduino code. It looks like the easiest way to do this is by converting my Arduino code to python code to have everything in one language. I need the code attached written in Python please, including the AccelStepper library. I am not comfortable with Python code, so I am not sure how to go about this.

Any help with this is much appreciated.

Thanks!


RE: Arduino Code to Python Code - Larz60+ - Dec-29-2021

We are glad to help with your effort, but won't do the work for you.
Please make an effort to convert your code, and ask questions about specific areas when problems are encountered.
Thank you.


RE: Arduino Code to Python Code - joe_momma - Jan-07-2022

raspberry pi stepper
Here's an example with for linux, maybe it can get you started going through the source code.


RE: Arduino Code to Python Code - Larz60+ - Jan-07-2022

This may prove useful:

your c code uses the DRV8825 driver which is available from pololu.

links:
https://www.ti.com/lit/ds/symlink/drv8825.pdf and https://www.pololu.com/product/2133
https://www.pololu.com/file/0J603/drv8824-drv8825-stepper-motor-driver-carrier-schematic-diagram.pdf

software (no python though) https://github.com/pololu/high-power-stepper-driver-arduino
Adafruit has a driver that they make which uses either arduino C, or CircuitPython it is their own design which used PWM to control the stepper, however comparing the C code vs Python may be helpful. More here: https://www.mouser.com/new/adafruit/adafruit-dcmotor-stepper-featherwing-addon/
The pin numbers will be different, but names should be the same