projects
/
teletype.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
initial commit
[teletype.git]
/
python
/
serial-test.py
1
import serial
2
import subprocess
3
import time
4
5
socat=subprocess.Popen(["/usr/bin/socat", "-d", "-d", "pty,raw,echo=0", "pty,raw,echo=0,link=/dev/teletype"])
6
time.sleep(3)
7
s = serial.Serial('/dev/pts/7',baudrate=9600,timeout=1)
8
query="query\n"
9
while True:
10
s.write(query.encode())
11
resp = s.read()
12
if resp: print(resp)