M commands (»machine functions«) switch something on the machine: spindle, coolant or program flow. Grbl only knows a few of them. Grbl 1.1 does not understand tool changes with M6; the app therefore splits programs with several bits into separate parts, one per bit.
M0 · Program pause
Pauses the program as if you had pressed Hold. Resume continues. Useful for pauses to re-clamp.
M1 · Optional stop
Like M0, but only if the controller has optional stop enabled. Grbl 1.1 ignores it.
M2 · Program end
Ends the program and resets some modes (among others G90, G54, spindle and coolant off).
M30 · Program end and rewind
Like M2. In Grbl there is no difference, both are common.
M3 · Spindle clockwise
Switches the spindle on (clockwise seen from above). The speed comes from S. In laser mode ($32=1) M3 switches the laser at constant power.
Example:
M3 S18000
M4 · Spindle counter-clockwise
Spindle counter-clockwise. Almost never right for milling. In laser mode M4 means power matched to speed, ideal for lasers.
M5 · Spindle off
Switches spindle or laser off.
M7 · Mist coolant on
Switches the mist coolant output (if fitted).
M8 · Flood coolant on
Switches the coolant output, or dust extraction if wired that way.
M9 · Coolant off
Switches M7 and M8 off.
M56 · Parking override
Switches parking on safety-door open on or off (only if the controller was built with this feature).
M6 · Tool change
grblHAL and FluidNC only
Grbl 1.1 does not know M6 and reports error 20. The app therefore splits programs with several bits into separate parts, one per bit.