定时器调用出现报错,IDE获取的画面停止,模块与电脑断开
-
之前发现这个问题,但是没得到解决
import sensor, image, time from pyb import Pin, Timer sensor.reset() # Reset and initialize the sensor. sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.skip_frames(time = 2000) # Wait for settings take effect. RUN = LED(4) clock = time.clock() # Create a clock object to track the FPS. def tick(timer): # we will receive the timer object when being called RUN.toggle() tim = Timer(4, freq=1) # create a timer object using timer 4 - trigger at 1Hz tim.callback(tick) # set the callback to our tick function while(True): img = sensor.snapshot() # Take a picture and return the image. # to the IDE. The FPS should increase once disconnected.
-
LED未定义。