Hi! Try this:
This way, the calls will return immediately, resulting in the motors starting simultaneously. My current project is a plotter, and when drawing a straight line I need to start the paper feeder and the carriage motors at the same time too.
The problem I am about to work around are these:
- Some time passes between the execution of the two commands, resulting in the motors not starting exactly at the same time.
- The speed of the motors need to be carefully adjusted according to the direction of the line to be drawn.
- The synchronization of the accelerations seem to be the biggest problem. Each line my plotter draws starts to be drawn in an awkward direction, and it takes a few millimeters until the right direction is achieved through proper adjustment of motor speeds.