Is there anyone who is using an ESP32 (any type) with a camera (any type) that is also saving to an sd card (any type), willing to share the precise pieces of hardware and what firmware .bin file they are using? I shall then purchase them and use those (and will hold you blameless for any outcomes).
I was making some progress in that I was able to take 1 picture and save it to an sd card using:
- ESP32-CAM-MB
- https://github.com/Lennyz1988/micropyth ... rmware.bin
- 32 GB SanDisk.
HOWEVER, only if my steps are like this:
Code: Select all
camera.init()
img = camera.capture()
camera.deinit()
uos.mount(machine.SDCard(), "/sd")
now_file = '-'.join([ str(x) for x in time.localtime()[:6] ]) + '.jpg'
imgFile = open("/sd/" + now_file, "wb")
imgFile.write(img)
imgFile.close()
uos.umount("/sd")
Code: Select all
camera.init()
img = camera.capture()
Code: Select all
camera.capture()
I have gone so far as to also try:
Code: Select all
del uos
del camera
I do fear it's an spi bus sharing issue but I was unable to get lemariva's fw to work and really I would have thought the camera.deinit() would allow me to take another shot.
However, I can take a bunch of pictures on the non-sd '/' and then use a cp/rm loop workaround:
Code: Select all
### Doing this Allows me to take multiple photos and ultimately get them to the sd card...
count=3
sleep=7
while count > 0:
import time
import camera
camera.init()
img = camera.capture()
camera.deinit()
now_file = '-'.join([ str(x) for x in time.localtime()[:6] ]) + '.jpg'
imgFile = open(now_file, "wb")
imgFile.write(img)
imgFile.close()
time.sleep(sleep)
count-=1
import uos
uos.mount(machine.SDCard(), "/sd")
from upysh import cp
from upysh import rm
[ cp(x,'/sd/'+x ) for x in os.listdir() if x.startswith('2022') or x.endswith('.jpg') ]
[ rm(x) for x in os.listdir() if x.startswith('2022') or x.endswith('.jpg') ]
#NB: mv yielded 'OSError: [Errno 1] EPERM' for some reason
#Verify
os.listdir('/')
os.listdir('/sd/')
#Unmount
uos.umount("/sd")
It get's it done and if it's what I need to do, so be it, but it just like there's got to be a better way? (or maybe it's me?)
As frustrating as this can be I am having lots of fun w/all this and am appreciative of the giant's whose shoulders I am standing upon to even get this far! Thanks in advance for any insights.