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

    connect SBC to Duet via Network and run gcode/macro with DSF

    Scheduled Pinned Locked Moved
    DSF Development
    2
    4
    375
    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.
    • job123undefined
      job123
      last edited by job123

      Hi all,
      I am new to the Duet. I would like to connect my SBC to the Duet via Network and then send commands with python to duet to run macros and eventually receive feedback from the duet.
      I have found 2 python code examples on github:

      def subscribe():
      subscribe_connection = SubscribeConnection(SubscriptionMode.PATCH)
      subscribe_connection.connect()

      try:
          # Get the complete model once
          object_model = subscribe_connection.get_object_model()
          print(object_model)
      
          # Get multiple incremental updates, due to SubscriptionMode.PATCH, only a
          # subset of the object model will be updated
          for _ in range(0, 3):
              update = subscribe_connection.get_object_model_patch()
              print(update)
      finally:
          subscribe_connection.close()
      

      and

      def send_simple_code():
      command_connection = CommandConnection(debug=True)
      command_connection.connect()

      try:
          # Perform a simple command and wait for its output
          res = command_connection.perform_simple_code("M115")
          print("M115 is telling us:", res)
      finally:
          command_connection.close()
      

      but I don't undesrtand here where should I insert the argument to connect to the board and what does this argument look like?

      Also what is the DSF UNIX socket?

      I would really appreciate your help.

      T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
      • T3P3Tonyundefined
        T3P3Tony administrators @job123
        last edited by

        @job123 DSF is designed to connect to the Duet via an SPI bus, not a network connection. If you need to use a network connection then you need to use the HTTP API:

        https://github.com/Duet3D/RepRapFirmware/wiki/HTTP-requests

        www.duet3d.com

        job123undefined 1 Reply Last reply Reply Quote 0
        • job123undefined
          job123 @T3P3Tony
          last edited by

          @T3P3Tony thanks for the reply.
          Do I have to install the RepRap firmware first? Also are there any python example codes on how to send commands from the SBC and receive feedback using this HTTP API?

          T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
          • T3P3Tonyundefined
            T3P3Tony administrators @job123
            last edited by

            @job123 RepRapFirmware needs to be running on the Duet for you to do anything with it of course, including connect to its API over HTTP. On the SBC you do not need any specific software form us.

            The API documentation is as linked before:
            https://github.com/Duet3D/RepRapFirmware/wiki/HTTP-requests

            This thread may be of interest to you:
            https://forum.duet3d.com/topic/31198/reprapfirmware-python-api

            This project may also be of intrest.
            https://github.com/AndyEveritt/DuetWebAPI

            www.duet3d.com

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Unless otherwise noted, all forum content is licensed under CC-BY-SA