Navigation

    Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    Gcode to make LED Light flash on/off repeatedly

    Gcode meta commands
    2
    3
    64
    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.
    • EducatingSavvas
      EducatingSavvas last edited by EducatingSavvas

      Hi I'm trying to make a LED flash on and off in a loop during a machine state.

      I have done this in the daemon.g file but noticing a long pause at the end of the part of the script that performs the light switch, while the rest of the daemon.g file is being looped through.

      if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed || !move.axes[3].homed ; if axes 0,1,2 and 3 are not homed do...
      	M42 P2 S0.4
      	M42 P1 S0
      	G4 P200
      	M42 P2 S0
      	M42 P1 S0.4
      	G4 P200
      	M42 P2 S0.4
      	M42 P1 S0
      	G4 P200
      	M42 P2 S0
      	M42 P1 S0.4
      	G4 P200
          
      elif state.status == "idle"
      	M42 P2 S0
      	M42 P1 S0
      

      Is there a way of creating a loop outside of the daemon.g file which I could reference to turn on or off with an M98 command, so the flashing light is more consistent?

      1 Reply Last reply Reply Quote 0
      • fcwilt
        fcwilt last edited by

        Have you considered just using an LED that has a built-in flasher?

        Frederick

        EducatingSavvas 1 Reply Last reply Reply Quote 0
        • EducatingSavvas
          EducatingSavvas @fcwilt last edited by EducatingSavvas

          @fcwilt Hi Frederick, I'm using a WWRGB LED strip for it's range of colours, so would prefer to achieve this onboard the Duet. Cheers, Savvas

          One alternative is to increase the dwell time to match the time it takes to go through the rest of the code in the daemon.g file - making the flashing seem more consistent.

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