Running into a bit of trouble as I'm trying to send serial gcode commands from my Windows PC to my M2 printer via USB.
I'm doing this through Python's pyserial package: https://pythonhosted.org/pyserial/index.html
For example, I just wanted to send a simple command to home the X axis "G28 X"
In Python using pyserial, this process looks something like this:
Code: Select all
import pyserial ser = serial.Serial('COM6', 115200) # I've verified that this is the proper COM port, second argument is baud rate, which I actually wasn't all that sure of, but I tried both 115200 and 9600 since they are both pretty common. I didn't bother tuning any other COM port settings. ser.write(b'G28 X\n') # My second issue comes up when I'm not sure of the line ending character that the M2 expects (maybe \n, \r or even \r\n) ser.close()
As of right now with the USB connected, when I send commands I hear the fans in the M2 momentarily slow down, which is typically a sign that the serial bus has received something (may or may not be formatted correctly), so I know that I have the right port and that my code is effectively sending something.
I just wanted to see if anyone has any experience with sending these gcode commands over serial using Python and if they have any other debug steps I could try.