From 36cd44ad23db1cb0707e5ec3b1fff8680708fb70 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sun, 28 Oct 2018 23:33:26 +0200 Subject: [PATCH] Add USB VCP example script. --- scripts/examples/02-Board-Control/usb_vcp.py | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 scripts/examples/02-Board-Control/usb_vcp.py diff --git a/scripts/examples/02-Board-Control/usb_vcp.py b/scripts/examples/02-Board-Control/usb_vcp.py new file mode 100644 index 000000000..e2a3e27f9 --- /dev/null +++ b/scripts/examples/02-Board-Control/usb_vcp.py @@ -0,0 +1,36 @@ +# 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.write("snap") +# sp.flush() +# size = struct.unpack('