LinuxCNC M4

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.

Source checked5/5 values · 2026-10-26

Specification

1 source
Languagegcode
CodeM4
GroupSpindle Control
SyntaxM4 [$n]
DialectLinuxCNC

Parameters

NameDescription
$nSelected spindle; if omitted the command defaults to spindle 0, and $-1 operates on all active spindles.

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

  • 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.
↑↓ navigate↵ openesc close