logo

请问如何使用PWM直接控制官方云台

2023-08-01 19:59
U
tp5g

使用一下代码后,不同次启动发现甚至转动的舵机都不同,使用的是官方舵机。

tim = pyb.Timer(4, freq=50)
ch1 = tim.channel(2, Timer.PWM, pin=Pin("P7"),pulse_width = 500 )
2023-08-02 11:23
I
网红小智智 星瞳科技
import time
from pyb import Servo

s1=Servo(1)
s2=Servo(2)

s1.calibration(500,2500,500)
s2.calibration(500,2500,500)

while True:
    s1.angle(0)
    s2.angle(0)
    time.sleep(1)
    s1.angle(90)
    s2.angle(90)
    time.sleep(1)