# 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()