How to make a loop of a Output_Pin ON and OFF?
-
Hello everybody,
I need to make a thing that I think that is easy but for a newbie as me not...
While I am printing I need that a output pin turn ON during 2 seconds and off 10 seconds, continuously while I am printing
ON 2 seconds
OFF 10 seconds
ON 2 seconds
OFF 10 seconds
...loop... until finish the printing//
I know how create a PIN output and turn on manually with the code, but not know how to make this "program" and start in loop while the printer is printing...How I can make this?
Best Regards
-
@FBG you'll want to use a while loop in daemon.g
https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands#loop
something likewhile state.status != "idle" M42 P0 S1 G4 S2 M42 P0 S0 G4 S10
edited to swap <> for !=
-
@jay_s_uk I try but....
Error: Failed to read code from macro daemon.g: Failed to evaluate "state.status <> idle": expected an expressionThis is my daemon file:
while state.status <> idle M42 P5 S1 G4 S2 M42 P5 S0 G4 S10
-
@FBG you missed the " around idle
-
-
@FBG also replace <> by !=
-
@dc42 said in How to make a loop of a Output_Pin ON and OFF?:
@FBG also replace <> by !=
Haha. Missed that! 🧑🦯 🤪
-
Thanks a lot!
Now is working properly!!
-
-
-
Sorry dears, not solved.
I was thinking that is working because don't show error but now say:Error: Failed to read code from macro daemon.g: empty while loop detected in line 2
My code is:
while state.status != "idle" M42 P5 S1 G4 S2 M42 P5 S0 G4 S10
-
@FBG You haven't indented the code
-
@FBG said Need to indent the code
My code is:
while state.status != "idle" M42 P5 S1 G4 S2 M42 P5 S0 G4 S10