为什么angle生成出来的波形是正弦波按占空比分割而不是方波,写定时器来生成的pwm也是正弦波按占空比分割
-
import sensor
import time
from pyb import Pin, Timer
from pyb import Servo
s1 = Servo(1)
while(1):
s1.angle(90)
time.sleep_ms(600)
s1.angle(45)
time.sleep_ms(600)
s1.angle(0)
time.sleep_ms(600)#p = Pin('P7') # P7 has TIM4, CH1
#tim = Timer(4, freq=250)
#ch = tim.channel(1, Timer.PWM, pin=p)
#ch.pulse_width_percent(20)
#while(1):
#time.sleep(0.1)
-
OpenMV本质上就是一个单片机哈,生成的PWM的方式也就和常用的STM32一样,一个周期内高电平的持续时间就是占空比哈