FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-can/examples/receive_all.py at develop · feuerball/python-can · GitHub
feuerball
/
python-can
Public
forked from
hardbyte/python-can
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-can
/
examples
/
receive_all.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
35 lines (25 loc) · 851 Bytes
Breadcrumbs
python-can
/
examples
/
receive_all.py
Copy path
File metadata and controls
executable file
·
35 lines (25 loc) · 851 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
"""
Shows how to receive messages via polling.
"""
import
can
from
can
.
bus
import
BusState
def
receive_all
():
"""Receives all messages and prints them to the console until Ctrl+C is pressed."""
# this uses the default configuration (for example from environment variables, or a
# config file) see https://python-can.readthedocs.io/en/stable/configuration.html
with
can
.
Bus
()
as
bus
:
# set to read-only, only supported on some interfaces
try
:
bus
.
state
=
BusState
.
PASSIVE
except
NotImplementedError
:
pass
try
:
while
True
:
msg
=
bus
.
recv
(
1
)
if
msg
is
not
None
:
print
(
msg
)
except
KeyboardInterrupt
:
pass
# exit normally
if
__name__
==
"__main__"
:
receive_all
()
Back
|
FazBrowse Home
|
New Git URL