我用的
import time
from pyb import Servo
from pyb import Pin, Timer
tim = Timer(4) # Frequency in Hz##############去掉频率
s1 = Servo(1) # P7
s2 = Servo(2) # P8
s1.angle(0)#上方舵机-30
s2.angle(0)#下方舵机-30和正30
while(True):
s1.angle(0)#上方舵机-30
s2.angle(0)#下方舵机-30和正30
ch3 = tim.channel(3, Timer.PWM, pin=Pin("P9"), pulse_width_percent=60)#####信道改3,引脚改P9
time.sleep(2000)
s1.angle(-30)
s2.angle(-30)
time.sleep(2000)