grbl / grbl

An open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on a straight Arduino
https://github.com/gnea/grbl/wiki
Other
5.42k stars 3.04k forks source link

How to disconnect the GRBL serial connection after the stepper motor has completed its entire operation #1866

Open lican-worker opened 4 months ago

lican-worker commented 4 months ago

I communicate with GRBL firmware via serial port using Python on my computer. The code is as follows. However, when I receive the "OK" message, the stepper motor is still in motion. I want to close the serial communication only when the stepper motor has completely stopped moving, i.e., when s.close() is executed. How can I achieve this result? image

lican-worker commented 4 months ago

cannot use "delay," because it's not possible to execute s.close() exactly when the motor comes to a complete stop.