Add USB<->serial loopback example to WaveShare Open103R

This commit is contained in:
Joshua Harlan Lifton
2013-10-26 21:59:12 -07:00
committed by Piotr Esden-Tempski
parent eeb900d800
commit 4505fa1926
4 changed files with 319 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
#! /usr/bin/python
import sys
import serial
def echo(text):
s = serial.Serial()
s.port = "/dev/ttyACM0"
s.open()
print s.read(s.write(text))
if __name__ == "__main__":
if len(sys.argv) > 1:
echo(" ".join(sys.argv[1:]))
else:
print "Usage: sudo echo.py hello world"