From 7c6c25b51c2a3fb2d6fee2cd8b1cdb37e20b27a3 Mon Sep 17 00:00:00 2001 From: Per Cederqvist <ceder@lysator.liu.se> Date: Thu, 23 Oct 2003 21:50:11 +0000 Subject: [PATCH] A demo program for the pySerial support. --- demo/read-serial.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 demo/read-serial.py diff --git a/demo/read-serial.py b/demo/read-serial.py new file mode 100644 index 0000000..96110d2 --- /dev/null +++ b/demo/read-serial.py @@ -0,0 +1,18 @@ +# This example opens the first serial port in 4800 bits per second and +# reads input from it. It terminates after 10 consecutive seconds +# with no input. + +import pcl_expect.pyserial +import pcl_expect + +port = pcl_expect.pyserial.Serial(0, baudrate=4800) + +x = pcl_expect.Controller() +while x.loop(): + if x.re(port, "..*"): + print "Got", repr(port.consumed) + elif x.timeout(): + print "Timeout" + break + +port.close() -- GitLab