# Motor Shield PWM Example
#
# This example shows off how to control the motor shield on your
# OpenMV Cam. The motor shield is controlled by using the PYB module
# which lets you do PWM to control the speed and set digital I/O pin
# states. The motor shield needs 6 I/O pins for both motors.
import pyb
#from pyb import Pin, Timer
tim = pyb.Timer(4, freq=50)
chA = tim.channel(1, pyb.Timer.PWM, pin=pyb.Pin("P7"))#
chB = tim.channel(2, pyb.Timer.PWM, pin=pyb.Pin("P8"))
times = 500
while (times >1):
chA.pulse_width_percent(40)#
chB.pulse_width_percent(30)#
times = times - 1
pyb.delay(10)
chA.pulse_width_percent(0)#向前
chB.pulse_width_percent(0)#https://singtown.com/learn/49603/
云台按照这个视频操作。
https://singtown.com/learn/50541/
舵机按照这个视频测试。