Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pcl-expect
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Per Cederqvist
pcl-expect
Commits
4e8b9364
Commit
4e8b9364
authored
21 years ago
by
Per Cederqvist
Browse files
Options
Downloads
Patches
Plain Diff
Added comments.
parent
2b89938a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
demo/microcom.py
+15
-1
15 additions, 1 deletion
demo/microcom.py
with
15 additions
and
1 deletion
demo/microcom.py
+
15
−
1
View file @
4e8b9364
...
@@ -5,18 +5,32 @@ import pcl_expect.pyserial
...
@@ -5,18 +5,32 @@ import pcl_expect.pyserial
import
pcl_expect.user
import
pcl_expect.user
import
pcl_expect
import
pcl_expect
# Open the serial port. You could specify parity, number of bits, and
# a lot of other things here as well. See the pySerial
# documentation.
port
=
pcl_expect
.
pyserial
.
Serial
(
0
,
baudrate
=
9600
)
port
=
pcl_expect
.
pyserial
.
Serial
(
0
,
baudrate
=
9600
)
# We need to listen for input from the user as well. Set the tty in
# RAW mode so that the user can enter Ctrl-C, DEL, Backspace and other
# special characters.
user
=
pcl_expect
.
user
.
User
(
pcl_expect
.
user
.
RAW
)
user
=
pcl_expect
.
user
.
User
(
pcl_expect
.
user
.
RAW
)
x
=
pcl_expect
.
Controller
()
x
=
pcl_expect
.
Controller
()
while
x
.
loop
():
while
x
.
loop
():
if
x
.
re
(
user
,
"
^
\035
"
):
if
x
.
re
(
user
,
"
^
\035
"
):
# Exit once the user hits Ctrl-].
break
break
elif
x
.
re
(
user
,
"
(?s).
"
):
elif
x
.
re
(
user
,
"
(?s).
"
):
# Anything else is sent to the seiral port.
port
.
send
(
user
.
consumed
)
port
.
send
(
user
.
consumed
)
elif
x
.
re
(
port
,
"
..*
"
):
elif
x
.
re
(
port
,
"
(?s)..*
"
):
# Anything that arrives from the serial port is sent to the
# user.
user
.
send
(
port
.
consumed
)
user
.
send
(
port
.
consumed
)
elif
x
.
timeout
():
elif
x
.
timeout
():
# Ignore timeouts.
pass
pass
port
.
close
()
port
.
close
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment