Hello everyone. I can successfully save a barcode payload to the SD card on the OpenMV. However, my operating system does not recognize that a file has been saved on the SD card until I reset the open MV. For my application, i want to detect when a new file is present, and then perform an action. I cannot do this correctly because I have to cycle power to the OpenMV camera to recognize that a new file has been created.
Is there a way in Micropython to save to the desktop of the computer that the Open MV is plugged into via the USB? Or, is there a way around having to restart the OpenMV to detect that a new file has been saved to the SD card?
Desktop OSes won’t rescan the flash drive unless plugged in. There’s no fix for this. The camera acting as a USB drive which can create files is not something handled by today’s desktop OS drivers.
You can however manually reset the OpenMV Cam in your script by issuing this command:
pyb.hard_reset()
…
An alternative method is just to print out the bardcode value. Anything that opens the OpenMV Cam’s VCP UART will see the print data as text as whatever baud rate they open the OpenMV Cam serial port at. Note that you have to disconnect OpenMV IDE. But, it’s pretty easy to get your script working with print and be good… and then use another program to read the printed data.
After some failed attempts, I was able to compile the code using XCode. I created a new project targeted for macOS and pasted the code into the main.cpp file and built the app. In the file viewer on the right I found the executable, found the location and copied it to my directory.