{"id":"mcode-m04","model_id":"M4","name":"LinuxCNC M4","summary":"M4 starts the selected spindle counterclockwise at the speed set by the S word. If the optional $n spindle selector is omitted, the command acts on spindle 0; $n selects a specific spindle and $-1 operates on all active spindles. If the spindle speed is zero, the spindle does not start turning until the speed or override is raised.","study_notes":["The document groups M3, M4, and M5 together with M19 as modal group 7 commands; M19 is cleared by any of M3, M4, or M5.","M4 may be used when the spindle is already turning, and M5 may be used when it is already stopped.","If the optional $n is omitted, operation is the same as a single-spindle machine using spindle 0."],"safety_notes":["With the S speed set to zero or the speed override at zero, M4 does not start spindle rotation; rotation begins when the speed or override is increased."],"sources":[{"url":"https://linuxcnc.org/docs/html/gcode/m-code.html#mcode:m3-m4-m5","title":"M-Codes","accessed":"2026-10-26"}],"verification":{"status":"source_checked","checked_at":"2026-10-26","values":5,"method":"llm_source_check"},"updated_at":"2026-10-26","type":"instruction","spec":{"language":"gcode","code":"M4","group":"Spindle Control","syntax":"M4 [$n]","parameters":[{"name":"$n","description":"Selected spindle; if omitted the command defaults to spindle 0, and $-1 operates on all active spindles."}],"dialect":"LinuxCNC","related":[],"standards":[]},"url":"https://machineschema.com/instruction/mcode-m04","license":"https://creativecommons.org/licenses/by/4.0/"}