output_rc()

Controls an RC (radio-controlled) servo motor by setting its position using a PWM signal.

Syntax

planetcnc.output_rc(pin, position)

Parameters

Parameter Type Description Comment
pin int The output pin number connected to the RC servo.
position float Servo position in percentage (0.0 to 100.0).

Return Value

Examples

#! /usr/bin/env python
 
import planetcnc
 
# Set an RC servo on pin 4 to 50% position
if planetcnc.output_rc(4, 50.0):
    print("RC servo moved to 50% position.")
else:
    print("Failed to move RC servo.")
 
# Move RC servo on pin 6 to full position (100%)
if planetcnc.output_rc(6, 100.0):
    print("RC servo moved to full position.")
else:
    print("Failed to move RC servo.")

See also

estop
stop
pause
start
output
output_pwm
output_rc
open
close