FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-orientation-visualization-app/SerialCommands.py at master · nelsonwenner/python-orientation-visualization-app · GitHub
nelsonwenner
/
python-orientation-visualization-app
Public
Notifications
You must be signed in to change notification settings
Fork
5
Star
15
Code
Issues
3
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-orientation-visualization-app
/
SerialCommands.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
29 lines (23 loc) · 653 Bytes
Breadcrumbs
python-orientation-visualization-app
/
SerialCommands.py
Copy path
File metadata and controls
29 lines (23 loc) · 653 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
import
serial
.
tools
.
list_ports
import
serial
class
SerialCommands
:
def
__init__
(
self
,
serial_speed
):
self
.
baud_rate
=
serial_speed
self
.
serial
=
None
@
staticmethod
def
get_ports
():
return
list
(
serial
.
tools
.
list_ports
.
comports
())
def
connect
(
self
,
port
):
self
.
serial
=
serial
.
Serial
(
port
,
self
.
baud_rate
)
self
.
serial
.
flushInput
()
def
is_connect
(
self
):
return
self
.
serial
.
isOpen
()
def
get_data
(
self
):
if
not
self
.
serial
.
isOpen
():
return
None
else
:
return
self
.
serial
.
readline
().
decode
(
'utf-8'
).
split
(
','
)
def
disconnect
(
self
):
if
self
.
serial
is
None
:
return
self
.
serial
.
close
()
Back
|
FazBrowse Home
|
New Git URL