Need help with pymavlink to output pwm

i am using this code, how do i define the pins? i connected the servo to every pin and nothing happens… i am using orangecube connected to the pc by usb and the script run without errors.

import time
from pymavlink import mavutil

def set_servo_pwm(servo_n, microseconds):

master.mav.command_long_send(
    master.target_system, master.target_component,
    mavutil.mavlink.MAV_CMD_DO_SET_SERVO,
    0,     
    servo_n + 8, 
    microseconds, 
    0,0,0,0,0 
)

master = mavutil.mavlink_connection(’/dev/ttyACM0’)
master.wait_heartbeat()

for us in range(0, 1900, 50):
set_servo_pwm(1, us)
time.sleep(0.125)
master.recv_match(type=“COMMAND_ACK”,blocking=True)
print (“pix is alive”)

thanks

I have tried your script and it runs perfectly.

The only problem is you forgot to define baud rate.

Also, this question is better to be asked on Ardupilot forum, as it is not hardware problem.