My main.py got replaced by different code which seems to be a default code of OpenMV

What causes the uploaded main.py to get replaced by a different code? Can I solve the issue and get my original main.py wirelessly? The main.py got replaced by following code which looks like a default state code of openMV:
import pyb, time
led = pyb.LED(3)
usb = pyb.USB_VCP()
while (usb.isconnected()==False):
led.on()
time.sleep_ms(150)
led.off()
time.sleep_ms(100)
led.on()
time.sleep_ms(150)
led.off()
time.sleep_ms(600)

That’s the default code that shipped with it. The IDE allows you to replace the script if you save it to the camera via the tools menu.

As for doing this wirelessly… right now no. We do have WiFi debug. It’s possible to extend that to save the script on the camera wirelessly in the future.

Now, I cannot access the OpenMV through USB but while it runs, first green led turns on then red and then blue gets on.What type of code it may have to act like that?

Also can we program the camera to capture image via SPI or UART through another microcontroller without accessing the USB?

Hi, it sounds like you should click connect in the IDE while your OpenMV cam is not connected and reset the default firmware back to stock.

As for your second question, yes, you can program the system to do anything you’d like.