openmv/scripts/examples/50-Arduino-Boards/Portenta-H7/50-Board-Control/servo_control.py
iabdalkader 98a29e0870 scripts/examples: Update examples.
- Add examples index.
- Remove RP2040's Bluetooth examples.
- Resort examples.
2023-10-29 21:21:55 +01:00

27 lines
667 B
Python

# This work is licensed under the MIT license.
# Copyright (c) 2013-2023 OpenMV LLC. All rights reserved.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# Servo Control Example
#
# This example shows how to use your OpenMV Cam to control servos.
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)