Python script send Gcode to duet 3 failed
-
Hi,
I am trying to use python to send Gcode to the board through USB serial port with the code (we use Visual Studio Code + python 3.7)
import serial #Serial takes these two parameters: serial device and baudrate ser = serial.Serial('COM6', 9600, timeout=0) command = 'M106 S128' ser.write(command.encode())
The board didn't response to the command. The connection is build successfully however the Gcode seems not recognized by the Duet 3. We tried to use YAT software to send this command and it works (the fan is then rotate).
We are wondering if this is because the python script lacks some function to transform string to the signal Duet 3 can read. Could you help with this? Thanks.
-
@kaguya Hi, you must add a newline character before the command will be processed. Try
command = "M106 S128\n"
. -
@otso Thank you very much. It works.
-