Controlling Duet from python
jonathan last edited by
A brief update and a question
Update. I can control several motors well enough either singly or in coupled movement via the console.
Question: I need to be able to send Gcode from a PC, preferably python. From hints in the documentation and the CodeConsole, it seems like I should be able to use a simple POST to send a command and get the response. This is easy with the python requests library, a single line of code. I have a Duet3 and a raspberry pi on the network configured at the router with a static address. Here is the stupid simple code (due to my ignorance):
"""simple command post to duet"""
def __init__(self, URL = 'http://188.8.131.52/'): """stasch the URL check validity? """ self.URL = URL def DuetCmd(self, command): response = requests.post(self.URL, data=command) return response
DuetCmd times out. The default port is 80. Likely I have misinterpreted the use of the PORT on the Raspberry pi. So how does one send individual lines of Gcode to the pi, thence the Duet? Is there a simpler way to do this?
Many thanks for any suggestions or pointers to resources.
@jonathan have you seen this documentation: