s1 = Servo(1) # P7->(PD12)
s2 = Servo(2) # P8
while(True):
for i in range(-90,90):
s1.angle(i)
s2.angle(i)
time.sleep(10)
for i in range(90,-90):
s1.angle(i)
s2.angle(i)
time.sleep(10)
### 现象
舵机无任何反应
## PWM测试
### 代码
```python
from pyb import Pin, Timer
p = Pin('P7') # P7 has TIM4, CH1
tim = Timer(4, freq=1000)
ch = tim.channel(1, Timer.PWM, pin=p)
ch.pulse_width_percent(50)
环境
问题描述
无法使用OpenMV的Servo
接线
棕色线->GND 红色线->5V 橙色线->D12
Servo测试
代码
s1 = Servo(1) # P7->(PD12) s2 = Servo(2) # P8 while(True): for i in range(-90,90): s1.angle(i) s2.angle(i) time.sleep(10) for i in range(90,-90): s1.angle(i) s2.angle(i) time.sleep(10)
现象
上电时转到固定角度