M42 - Set Pin State

control Set an analog or digital pin to a specified state.

For custom hardware not officially supported in Marlin, you can often just connect up an unused pin and use M42 to control it.


M42 [P<int>] S<int>

Argument Description

A digital pin number (even for analog pins) to write to. (LED_PIN if omitted)


The state to set. PWM-able pins may be set from 0-255.