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 viewtopic.php?f=6&t=892
So here's what I have on the sending side currently:
Code: Select all
import time, sensor, image, ustruct from pyb import UART, USB_VCP uart = UART(3, 19200, timeout_char=1000) sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) clock = time.clock() usb = USB_VCP() while(True): clock.tick() img = sensor.snapshot().compress() usb.send(ustruct.pack("<L", img.size())) usb.send(img) #print(img) print(clock.fps()) time.sleep(100)
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.