Hi!
Can’t get images to be written to micro-SD instead of internal flash. The script includes the lines:
img = sensor.snapshot ()
img.save (“example.jpg”)
The card is formatted with FAT16 under Windows and inserted into OpenMV. But the image is written to the internal flash
From manual: “8. Finally, if you insert a micro-sd card into the micro-sd card slot on your OpenMV Cam the micro-sd card will replace the internal flash drive for all of the above…Last, feel free to save pictures/video on a micro-sd card. Just don’t do this on your OpenMV Cam’s internal flash drive.”
I also read that need to transfer “OS” to the SD card for this. How to do it? Copy all files from internal flash to SD flash via PC and insert SD to OpenMV Cam? Tried it - it doesn’t work! What to do?
1 Like
It’s likely the SD is not detected, if it is detected it should show up on the PC when the camera is connected like it’s a flash driver. Can you please to format it again, it’s best to use exFat if not possible use FAT32.
Can you see the disk mounted when the camera is connected ? If not then it’s not detected, and you should try a different card.
Through the card reader, this SD 1gb is normally formatted and written in the system
Windows, read. Why doesn’t it fit OpenMV?
Some types of cards just have issues, please try any different type (I suggest Samsung EVO) and let us know how it goes.
I see only intermal flash and 3 files: .openmv_disk, read.me, main.py
Yes makes sense, the card is not detected at all, please see the reply above also might want to check the socket make sure there’s no dust inside or anything like that.
Thanks! appeared with the only .openmv_disk file. The internal disk is not visible. now. I’ll try to run the sketch.
1 Like
Can you help me more - swear if after the name I_ add a number in order of currentName:
some wrong in: img.save(‘images/’ + newName+counterNumber, quality=90)
How do you convert an int counterNumber to a string?
import time, pyb , sensor, image, lcd, os
from pyb import Pin, LED
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA2) # Special 128x160 framesize for LCD Shield.
lcd.init() # Initialize the lcd screen.
pin0 = Pin('P4', Pin.IN, Pin.PULL_UP)
pin1 = Pin('P5', Pin.OUT_PP, Pin.PULL_NONE) #external LEDs
newName='I_' #prefix of file name
counterNumber=1 #numbher of file start from...
countCheck = 0
RED_LED_PIN = 1
GREEN_LED_PIN = 2
BLUE_LED_PIN = 3
IR_LED_PIN =4
# Make a temp directory
if not "images" in os.listdir(): os.mkdir("images")
#internal LEDS
pyb.LED(RED_LED_PIN).off()
pyb.LED(GREEN_LED_PIN).off()
pyb.LED(BLUE_LED_PIN).off()
pyb.LED(IR_LED_PIN).off()
#LOOP
while(True):
lcd.display(sensor.snapshot()) # Take a picture and display the image.
for i in range(4):
if pin0.value()==0:
countCheck += 1
time.sleep_ms(50)
else:
countCheck = 0
if countCheck>=3:
countCheck = 0
pyb.LED(RED_LED_PIN).on()
pin1.value(1)
img = sensor.snapshot() # make foto
#img.save("example.jpg")
img.save('images/' + newName+counterNumber, quality=90)
counterNumber +=1
countCheck +=1
time.sleep_ms(1000)
pyb.LED(RED_LED_PIN).off()
pin1.value(0)
Work!!! Thanrs!!! Help me please one more. How to convert variable counterNumber from int to string? img.save (‘images /’ + newName + counterNumber, quality = 90)
This is a very basic Python question you can find an answer to if you just Google, so please before the next question try searching first.
img.save ('images/%s%d'%(newName, counterNumber), quality = 90)
You helped me a lot, fought with SD flash for several hours!
1 Like