Gcode to make LED Light flash on/off repeatedly
-
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?
-
Have you considered just using an LED that has a built-in flasher?
Frederick
-
@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.
-
If you manage to make, the code work properly? If yes, can you please share the code here?
-
@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.
-
@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.