为何定时器和拍照功能放一起会导致程序跑死?【最简单的例程,星瞳首问】
-
如题。
具体代码和截图见下。import time import sensor#引入感光元件的模块 from pyb import Pin, Timer sensor.reset()#初始化感光元件 sensor.set_pixformat(sensor.RGB565)#设置为彩色 sensor.set_framesize(sensor.QVGA)#设置图像的大小 sensor.skip_frames()#跳过n张照片,在更改设置后,跳过一些帧,等待感光元件变稳定。 def tick(timer): # we will receive the timer object when being called print("Timer callback") tim = Timer(4, freq=100) # create a timer object using timer 4 - trigger at 1Hz tim.callback(tick) # set the callback to our tick function while (True): time.sleep(1000) img = sensor.snapshot()#拍摄一张照片,img为一个image对象'''
请各位大佬赐教。或者谁做的实验或者小项目用过这两个组合的发我一份呀。^-^