• Tags
  • Documentation
  • Order
  • Register
  • Login
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.
  • undefined
    huai3895
    last edited by 27 Nov 2020, 07:04

    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
    • undefined
      oliof
      last edited by 27 Nov 2020, 07:55

      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<>

      undefined 1 Reply Last reply 27 Nov 2020, 08:35 Reply Quote 0
      • undefined
        huai3895 @oliof
        last edited by 27 Nov 2020, 08:35

        @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

        undefined undefined 2 Replies Last reply 27 Nov 2020, 08:57 Reply Quote 0
        • undefined
          Donpi @huai3895
          last edited by 27 Nov 2020, 08:57

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

          undefined 1 Reply Last reply 27 Nov 2020, 11:15 Reply Quote 0
          • undefined
            huai3895 @Donpi
            last edited by 27 Nov 2020, 11:15

            @Donpi M950 P2 C"!OUT7" Q65535

            undefined 1 Reply Last reply 27 Nov 2020, 11:20 Reply Quote 0
            • undefined
              Donpi @huai3895
              last edited by 27 Nov 2020, 11:20

              @huai3895 if you type/send

              M42 P2 S1
              

              in the console does it works ?

              undefined 1 Reply Last reply 28 Nov 2020, 04:49 Reply Quote 0
              • undefined
                OwenD @huai3895
                last edited by 27 Nov 2020, 20:11

                @huai3895
                Remove the brackets (...)

                1 Reply Last reply Reply Quote 0
                • undefined
                  huai3895 @Donpi
                  last edited by 28 Nov 2020, 04:49

                  @Donpi yes ,it works

                  undefined 1 Reply Last reply 29 Nov 2020, 10:04 Reply Quote 1
                  • undefined
                    Donpi @huai3895
                    last edited by 29 Nov 2020, 10:04

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

                    undefined 1 Reply Last reply 3 Dec 2020, 13:38 Reply Quote 0
                    • undefined
                      huai3895 @Donpi
                      last edited by 3 Dec 2020, 13:38

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

                      undefined 1 Reply Last reply 3 Dec 2020, 13:42 Reply Quote 0
                      • undefined
                        huai3895 @huai3895
                        last edited by 3 Dec 2020, 13:42

                        @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
                        1 out of 11
                        • First post
                          1/11
                          Last post
                        Unless otherwise noted, all forum content is licensed under CC-BY-SA