Skip to content
Snippets Groups Projects
Commit 9935aee5 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

New demo program: a minicom-like program with no interpretation of the

input from the serial port.
parent 56a01682
No related branches found
No related tags found
No related merge requests found
# This example opens the first serial port in 9600 bits per second and
# connects the keyboard to it. It terminates when the user presses Ctrl-].
import pcl_expect.pyserial
import pcl_expect.user
import pcl_expect
port = pcl_expect.pyserial.Serial(0, baudrate=9600)
user = pcl_expect.user.User(pcl_expect.user.RAW)
x = pcl_expect.Controller()
while x.loop():
if x.re(user, "^\035"):
break
elif x.re(user, "(?s)."):
port.send(user.consumed)
elif x.re(port, "..*"):
user.send(port.consumed)
elif x.timeout():
pass
port.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment