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

    How to make io on/off(m42 pn s255/0) by just one macros

    Scheduled Pinned Locked Moved
    General Discussion
    4
    11
    427
    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.
    • huai3895undefined
      huai3895
      last edited by

      How to make io on/off(m42 pn s255/0) by just one macros

      by c or c++,i just need as thus:
      if s=255
      s=0
      or
      s=255

      But idont know can gcode do that?
      I read GCode Meta Commands,still find no way。(https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands#Section_Programming_constructs)

      huai

      1 Reply Last reply Reply Quote 0
      • oliofundefined
        oliof
        last edited by

        See https://forum.duet3d.com/topic/19799/toggle-gpio-with-external-trigger-on-off-on/4?_=1606417543586

        <>RatRig V-Minion Fly Super5Pro RRF<> V-Core 3.1 IDEX k*****r <> RatRig V-Minion SKR 2 Marlin<>

        huai3895undefined 1 Reply Last reply Reply Quote 0
        • huai3895undefined
          huai3895 @oliof
          last edited by

          @oliof I m just too noob,that i need to know how to write it concrete
          [I have use “OUT7” on duet3 6hc,M950 S2 C"OUT7"Q65535,And i try write this in macros :
          (If OUT7.pwm==0
          M42 P2 S1
          else
          M42 P2 S0)
          but it warn with:(Error: Failed to read code from macro Z-axis-brake: unexpected else in line 3)]
          THANKS
          huai

          Donpiundefined OwenDundefined 2 Replies Last reply Reply Quote 0
          • Donpiundefined
            Donpi @huai3895
            last edited by

            @huai3895 can you post the code of your config.g where you create the pin ?

            huai3895undefined 1 Reply Last reply Reply Quote 0
            • huai3895undefined
              huai3895 @Donpi
              last edited by

              @Donpi M950 P2 C"!OUT7" Q65535

              Donpiundefined 1 Reply Last reply Reply Quote 0
              • Donpiundefined
                Donpi @huai3895
                last edited by

                @huai3895 if you type/send

                M42 P2 S1
                

                in the console does it works ?

                huai3895undefined 1 Reply Last reply Reply Quote 0
                • OwenDundefined
                  OwenD @huai3895
                  last edited by

                  @huai3895
                  Remove the brackets (...)

                  1 Reply Last reply Reply Quote 0
                  • huai3895undefined
                    huai3895 @Donpi
                    last edited by

                    @Donpi yes ,it works

                    Donpiundefined 1 Reply Last reply Reply Quote 1
                    • Donpiundefined
                      Donpi @huai3895
                      last edited by

                      @huai3895 ok so like @OwenD said, I think that the problem are the ( )

                      huai3895undefined 1 Reply Last reply Reply Quote 0
                      • huai3895undefined
                        huai3895 @Donpi
                        last edited by

                        @Donpi the () just make easy to show you code,infact i never write it in my macros

                        huai3895undefined 1 Reply Last reply Reply Quote 0
                        • huai3895undefined
                          huai3895 @huai3895
                          last edited by

                          @huai3895 But i still find something:with duet3&raspberry pi(duet pi with GUI) ,M409 just report nothing, so mabe its just a bug with duet pi?

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