编译esp32cam micropython 固件

对于esp32cam,我的印象其实不咋地,可以说除了便宜一无是处,画质渣,速度慢,可用引脚所剩无几。不过30就能买个能拍照的单片机,还要啥自行车,以前都是直接下载现成的固件,现在也想自己研究一下怎么编译了,还是抄作业,仓库地址在这里:
esp32cam-micropython
难度不大,readme有完整的教学步骤,现在终于会了一点添加idf组件的方法了。
测试程序:

import camera
import time
from machine import Pin
outpin=Pin(13,Pin.OUT)
camera.init(0, format=camera.GRAYSCALE, framesize=camera.FRAME_96X96,fb_location=camera.DRAM)
motion=50000  #画面检测阈值  越小越灵敏 
flen=9216  #画面共有9126BYTES
lowtime=10   #输出低的时间

def stable():
    for i in range(0,5):
        camera.capture()
stable()
while 1:
    fb=camera.capture()
    bb=camera.capture()
    compare=0
    for i in range(0,flen):
        if i%2==0:
            t=abs(fb[i]-bb[i])
            compare+=t
    print(compare)
    if compare>motion:
        print('motion detected!')
        outpin.value(0)
        time.sleep(lowtime)
        outpin.value(1)
        stable()
        print('continue detecting')




文档基本没有,看函数自己也能猜个大概,唯一的毛病就是camera.init()这句一次上电只能运行一次。。。不过也是无伤大雅了。

猜你喜欢

转载自blog.csdn.net/jd3096/article/details/128433943