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

Toggle output/fan using button/trigger?

Scheduled Pinned Locked Moved
General Discussion
3
5
559
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
    vwegert
    last edited by 3 Jan 2019, 19:33

    As far as I understand the documentation, it should be possible to connect a simple pushbutton to an unused endstop (E1 for example) and use M581 to have it execute a custom g-code file. I've got a constant current driver for some LED strips in my printer, and I would like to connect them to an unused fan output - they draw about 600 mA, so the current should not be a problem. I don't know how the LED driver would react to being fed PWM input voltage, but then, I don't have to try that... Anyway, I could use M42 to enable or disable the LED. The problem is - I would like to have a toggle button, and as far as I can see, that's not possible at the moment, right? I would have to use a NO/NC switch and trigger on the rising/falling edge to switch the lighting on and off - or is there a way to conditionally branch between two parts of the trigger file?

    (Also, the documentation for M42 reads "See also M583.", but M583 isn't documented - probably a typo?)

    undefined 1 Reply Last reply 4 Jan 2019, 09:56 Reply Quote 0
    • undefined
      dc42 administrators @vwegert
      last edited by 4 Jan 2019, 09:56

      @vwegert, you could use either a single switch and triggers on the rising and falling edges, or a toggle switch connected to 2 endstop inputs.

      Conditional GCode is scheduled for implementation in RRF 2.03.

      Thanks for pointing out the error in the M42 documentation. I've corrected it.

      Duet WiFi hardware designer and firmware engineer
      Please do not ask me for Duet support via PM or email, use the forum
      http://www.escher3d.com, https://miscsolutions.wordpress.com

      1 Reply Last reply Reply Quote 0
      • undefined
        totalos
        last edited by 30 Jul 2019, 20:55

        Hello.
        Has something changed in this matter?
        I have the same problem: I need to turn on and off with one button (not stable).
        Or maybe it is possible to write a macro to make some g-code depending on the result of checking another g-code?

        1 Reply Last reply Reply Quote 0
        • undefined
          dc42 administrators
          last edited by 31 Jul 2019, 06:53

          I think you can do that by having two M581 trigger numbers attached to the same pin. Each trigger file would turn the fan or led on or off, then disable its own trigger number and enable the other one.

          Duet WiFi hardware designer and firmware engineer
          Please do not ask me for Duet support via PM or email, use the forum
          http://www.escher3d.com, https://miscsolutions.wordpress.com

          1 Reply Last reply Reply Quote 0
          • undefined
            totalos
            last edited by 31 Jul 2019, 15:58

            Thank you for your response. It's a good idea.
            It works. In config.g I wrote:
            M581 T2 E0 S0;

            and in
            trigger2.g :
            M80 ;
            M581 T2 S-1;
            M581 T3 E0 S0;

            trigger3.g:
            M81
            M581 T3 S-1;
            M581 T2 E0 S0;

            There is one drawback to this solution.
            When the M80 or M81 is executed in a different way, eg via Web or g-code printing, the button must be pressed twice.
            Thank you for your help and I will be grateful for other suggestions.

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