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

Gcode to make LED Light flash on/off repeatedly

Scheduled Pinned Locked Moved
Gcode meta commands
4
6
589
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
    EducatingSavvas
    last edited by EducatingSavvas 12 Feb 2021, 21:36

    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
    • undefined
      fcwilt
      last edited by 12 Feb 2021, 21:40

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

      Frederick

      Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

      undefined 1 Reply Last reply 13 Feb 2021, 08:03 Reply Quote 0
      • undefined
        EducatingSavvas @fcwilt
        last edited by EducatingSavvas 13 Feb 2021, 08:03

        @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
        • undefined
          xerato
          last edited by 3 Dec 2022, 13:42

          If you manage to make, the code work properly? If yes, can you please share the code here?

          undefined undefined 2 Replies Last reply 3 Dec 2022, 15:32 Reply Quote 0
          • undefined
            dc42 administrators @xerato
            last edited by 3 Dec 2022, 15:32

            @xerato @EducatingSavvas there is a delay of 10 seconds between consecutive executions of daemon.g. This is to avoid SD card access contention between daemon.g and a file being printed. If you need a smaller delay, put all that code inside a while-loop, and include a shorter delay (e.g. G4 S1) at the end of the loop.

            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
              xerato @xerato
              last edited by 8 Dec 2022, 19:28

              @xerato said in Gcode to make LED Light flash on/off repeatedly:

              If you manage to make, the code work properly? If yes, can you please share the code here?
              I just got the same led strips, but I didn't know that it could be complicated to set them up properly. I thought they would have an application like a smart led light bulb, so I just set the time to choose the color. I'm thinking right now of buying other strips from the vont brand. My friend who has these strips told me they have a proper application, so we have no problem setting them up. So if you didn't make the code work let me know, and I will order new strips momentarily.

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