# This work is licensed under the MIT license. # Copyright (c) 2013-2023 OpenMV LLC. All rights reserved. # https://github.com/openmv/openmv/blob/master/LICENSE # # USB VCP example. # This example shows how to use the USB VCP class to send an image to PC on demand. # # WARNING: # This script should NOT be run from the IDE or command line, it should be saved as main.py # Note the following commented script shows how to receive the image from the host side. # # #!/usr/bin/env python2.7 # import sys, serial, struct # port = '/dev/ttyACM0' # sp = serial.Serial(port, baudrate=115200, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, # xonxoff=False, rtscts=False, stopbits=serial.STOPBITS_ONE, timeout=None, dsrdtr=True) # sp.setDTR(True) # dsrdtr is ignored on Windows. # sp.write("snap") # sp.flush() # size = struct.unpack('