output_pwm()

Controls a PWM output on the machine by setting the duty cycle and optionally the frequency.

Syntax

output_pwm(pin, duty)
output_pwm(pin, duty, frequency)

Parameters

Parameter Type Description
pin Number The output pin number to control.
duty Number Duty cycle percentage (0.0 - 100.0).
frequency Number (Optional) PWM frequency in Hz. (0 - 500000) optional

Return Value

Examples

Set output pin 1 to 50% duty cycle

output_pwm(1, 50);  

Set output pin 2 to 75% duty cycle at 1 kHz

output_pwm(2, 75, 1000);

Set output pin 6 to 20% duty cycle at default frequency

output_pwm(6, 20);

See also

output
output_pwm
output_rc

mist
flood
spindle

extout1
extout2