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

    Increasing M106 S value in a macro incrementaly

    Scheduled Pinned Locked Moved
    General Discussion
    2
    3
    205
    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.
    • appjawsundefined
      appjaws
      last edited by

      I am trying to change the brightness of my LED strip slowly to a preset value.
      Using M106 P3 and increase the S value in increments.
      This is the macro

      while fans[3].actualValue < 40
      M106 P3 S^fans[3].actualValue + 2
      ; {Sfan[3].requestedValue} = {Sfan[3].actualValue} + 2
      G4 S5 ;Wait for 5 second
      echo "LED Red Requested value = " ^ fans[3].requestedValue
      echo "LED Red Actual value = " ^ fans[3].actualValue

      Error M106: expected string expression

      Is this possible?

      appjaws - Core XYUV Duet Ethernet Duex5
      firmware 3.5.0-rc.4 Web Interface 3.5.0-rc.4
      Ormerod 1-converted to laser engraver, Duet wifi
      OpenSCAD version 2024.03.18
      Simplify3D 5.1.2

      1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators
        last edited by dc42

        @appjaws said in Increasing M106 S value in a macro incrementaly:

        M106 P3 S^fans[3].actualValue + 2

        Try:

        M106 P3 S{fans[3].actualValue + 2}

        In any standard GCode command (not meta command like 'if' or 'while'), if you want to use an expression as a parameter value, you must enclose the expression in { }.

        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
        • appjawsundefined
          appjaws
          last edited by

          @dc42 said in Increasing M106 S value in a macro incrementaly:

          M106 P3 S{fans[3].actualValue + 2}

          Thanks, great answer, I am learning a lot.

          appjaws - Core XYUV Duet Ethernet Duex5
          firmware 3.5.0-rc.4 Web Interface 3.5.0-rc.4
          Ormerod 1-converted to laser engraver, Duet wifi
          OpenSCAD version 2024.03.18
          Simplify3D 5.1.2

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