Positioning of stepper motors in X and Y using a subroutine
This subroutine provides a simple way to move at different coordinates in a 2D zone (X and Y).
- GotToX and GoToY are the coordinates you want to go to.
- SpeedMax is the maximum speed of X and/or Y. If necessary a second speed is calculated to arrive at the coordinates at the same time.
- Done=1 once the coordonates are reached.
- CurrentLocation gives you in real time the location of each axis.
- SoftStartStop telling it how long to take to reach the speed
A short video on what you can do easily with this subroutine
In the subroutine, you can see different steps
- Step 0
- To arrive at the same time in X and Y. Calculation of the speed for the slowest axis.
- Step 1
- We start both stepper motors.
- Step 2
- We are waiting for the end of the movment.
At each step, we leave the subroutine to let the main program continue.
The main program is there as an example
We use a table with each coordinate.
And we call the subroutine
You can dowload the subroutine here