i wrote this code to my esp32-cam with micropython but when i run it, it shows me error below and doesn’t take picture, at first it showed this error and start rebooting and restarting, i plogged in the 5v and it did not restart, but now i have this error:
import machine
from machine import Pin
import camera
import time
flash = Pin(4, Pin.OUT)
uos.mount(machine.SDCard(), "/sd") #mount the SD card
camera.init()
camera.quality(10)
camera.framesize(9)
count = 0
while True:
if count == 2200:
print("Completed")
break
flash.value(1)
pic = camera.capture()
flash.value(0)
file = open("/sd/pics/"+str(count)+".jpg", "wb")
file.write(pic)
file.close()
print(count, " done")
count += 1
time.sleep(1)
print("done")
I (462) psram: This chip is ESP32-D0WD
I (462) spiram: Found 16MBit SPI RAM device
I (462) spiram: SPI RAM mode: flash 40m sram 40m
I (465) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (472) cpu_start: Pro cpu up.
I (476) cpu_start: Application information:
I (481) cpu_start: Compile time: Dec 13 2019 08:15:03
I (487) cpu_start: ELF file SHA256: 0000000000000000...
I (493) cpu_start: ESP-IDF: v3.3
I (498) cpu_start: Starting app cpu, entry point is 0x40083830
I (490) cpu_start: App cpu up.
I (946) spiram: SPI SRAM memory test OK
I (946) heap_init: Initializing. RAM available for dynamic allocation:
I (947) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (953) heap_init: At 3FFBAC10 len 000253F0 (148 KiB): DRAM
I (959) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (965) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (972) heap_init: At 40094998 len 0000B668 (45 KiB): IRAM
I (978) cpu_start: Pro cpu start user code
I (983) spiram: Adding pool of 2048K of external SPI memory to heap allocator
I (109) cpu_start: Chip Revision: 2
W (110) cpu_start: Chip revision is higher than the one configured in menuconfig. Suggest to upgrade it.
I (113) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (123) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (153) main: Allocated 767K for micropython heap at 0x3f940020
I (293) sccb: pin_sda 26 pin_scl 27
I (293) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
E (353) camera: Detected camera not supported.
E (353) camera: Camera probe failed with error 0x20004
E (353) camera: Camera Init Failed
E (353) camera: Quality Failed
E (363) camera: Framesize Failed
E (363) camera: Camera Capture Failed
Traceback (most recent call last):
File "main.py", line 20, in <module>
TypeError: object with buffer protocol required
I asked chatgpt but it doesn’t work. please help