Example: 50-OpenMV-Boards/50-STM32-Boards/50-Board-Control/servo_control.py

# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# 舵机控制示例
#
# 本示例展示了如何利用OpenMV摄像头控制舵机。

import time
from pyb import Servo

s1 = Servo(1)  # P7
s2 = Servo(2)  # P8
s3 = Servo(3)  # P9

while True:
    for i in range(1000):
        s1.pulse_width(1000 + i)
        s2.pulse_width(1999 - i)
        s3.pulse_width(1000 + i)
        time.sleep_ms(10)
    for i in range(1000):
        s1.pulse_width(1999 - i)
        s2.pulse_width(1000 + i)
        s3.pulse_width(1999 - i)
        time.sleep_ms(10)

results matching ""

    No results matching ""