Continously send images to pc


I’m trying to grab the camera data from an OpenMV M7 camera to use in another program. The camera will remain connected to the pc it needs to send the data to via USB. Transmitting the images by UART or Serial is the goal.

I’m still a bit of a newbie to i/o, but using the thread here I’ve been able to get a bit of a start

So here’s what I have on the sending side currently:

import time, sensor, image, ustruct
from pyb import UART, USB_VCP

uart = UART(3, 19200, timeout_char=1000)

sensor.skip_frames(time = 2000)
clock = time.clock()
usb = USB_VCP()

    img = sensor.snapshot().compress()
    usb.send(ustruct.pack("<L", img.size()))

There are bits of UART in there but ignore them–for simplicity’s sake I’m starting with Serial. The program in question I’m supposed to be sending data to hasn’t been written yet so currently nothing is being done with the sent data.

I would appreciate it if someone could point me in the right direction re:

  1. Is the code above correct? I saw there’s a Serial class too but I’m not sure if that’s needed.
  2. What would be the simplest way to test if the images are being sent + can be reassembled correctly? Ex. should I whip up a Processing sketch, or?

Thanks for the help. :nerd:


You can use our module to grab frames from the camera in Python:

And there’s an example script using this module and pygame to draw the frames:

Does this help ?