logo

cannot import name Timer

2019-07-02 15:41
D
xsyz

PWM示例代码,报错cannot import name Timer

# PWM Control Example
#
# This example shows how to do PWM with your OpenMV Cam.

import time
from pyb import Pin, Timer

tim = Timer(4, freq=1000) # Frequency in Hz
# Generate a 1KHz square wave on TIM4 with 50% and 75% duty cycles on channels 1 and 2, respectively.
ch1 = tim.channel(1, Timer.PWM, pin=Pin("P7"), pulse_width_percent=50)
ch2 = tim.channel(2, Timer.PWM, pin=Pin("P8"), pulse_width_percent=75)

while (True):
    time.sleep(1000)
e9354158-c9ce-43b8-8e4a-1afaa7c909b6.png
I
网红小智智 星瞳科技

请提供你的硬件版本,固件版本。

2019-07-02 15:50
D
xsyz

固件3.15.0-

OpenMV IDE2.2.0

69da2584-81bd-4479-8da1-1977eaba7849.png
14d1d822-0af9-4439-8285-2487c67ae5b0.png
I
网红小智智 星瞳科技

硬件版本,是OpenMV2还是OpenMV3还是OpenMV4。

2019-07-02 15:57
D
xsyz

@kidswong999 OpenMV3

I
网红小智智 星瞳科技

我使用OpenMV3没有出现错误。

请升级到最新的固件,如果解决不了,联系售后维修。

2019-10-15 20:31
7
ytnk

我也是一样的问题。 求解