I am currently working on a short G-code to turn a LED light while moving through a specified path and then turning it off while moving to the next path. So I used M42 but It seems to turn it and off even before the path has started. My code is the following:

G28 ; home all axes
G1 Z20 F3000 ; lift
M42 P40 S0
; ----- HEADER -----
G1 F720 X112.33511 Y81.240995 Z258.23098 E0
M42 P40 S255
G4 P2000
G1 F720 X105.351433 Y81.240995 Z163.706453 E0
G1 F720 X183.876808 Y81.240995 Z122.186662 E0
G1 F720 X227.765593 Y81.240995 Z229.233326 E0
G1 F720 X244.826242 Y81.240995 Z133.513642 E0
M42 P40 S0
; ------ FOOTER -----
G28 X0 ; home X axis

Does anyone know something further about this command? May be there is some parameter so it waits untill it's set on or off?

  • $\begingroup$ is that repRap g-code or marlin g-code or klipper... $\endgroup$ – Trish May 8 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.