mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
Add USB VCP test script.
This commit is contained in:
parent
cdfcf839f1
commit
0774f8d159
14
tools/usbd_vcp_test.py
Executable file
14
tools/usbd_vcp_test.py
Executable file
@ -0,0 +1,14 @@
|
||||
#!/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('<L', sp.read(4))[0]
|
||||
img = sp.read(size)
|
||||
sp.close()
|
||||
|
||||
with open("img.jpg", "w") as f:
|
||||
f.write(img)
|
Loading…
Reference in New Issue
Block a user