p7p8p9以外的io口如何输出PWM?直接将Timer里的第一参数改为定时器1会报错
-
-
如果涉及代码,需要报错提示与全部代码文本,请注意不要贴代码图片
-
@kidswong999 P7P8P9以外的Iio口如何输出PWM
-
timer1 用不了,因为摄像头采集用了timer1
import sensor, image, time from pyb import Pin, Timer sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) tim = Timer(2, freq=1000) # Frequency in Hz ch3 = tim.channel(3, Timer.PWM, pin=Pin("P4"), pulse_width_percent=50) clock = time.clock() while(True): clock.tick() img = sensor.snapshot() print(clock.fps())