• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

Python script send Gcode to duet 3 failed

Scheduled Pinned Locked Moved
General Discussion
2
3
269
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    Kaguya
    last edited by 6 Apr 2022, 18:27

    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.

    undefined 1 Reply Last reply 6 Apr 2022, 21:52 Reply Quote 0
    • undefined
      Otso @Kaguya
      last edited by 6 Apr 2022, 21:52

      @kaguya Hi, you must add a newline character before the command will be processed. Try command = "M106 S128\n".

      undefined 1 Reply Last reply 7 Apr 2022, 09:16 Reply Quote 1
      • undefined
        Kaguya @Otso
        last edited by 7 Apr 2022, 09:16

        @otso Thank you very much. It works.

        1 Reply Last reply Reply Quote 0
        • undefined infiniteloop referenced this topic 2 Jun 2022, 10:42
        1 out of 3
        • First post
          1/3
          Last post
        Unless otherwise noted, all forum content is licensed under CC-BY-SA