Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Automated Cell-Tester
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
dsonger2
Automated Cell-Tester
Commits
17005a47
There was an error fetching the commit references. Please try again later.
Commit
17005a47
authored
3 years ago
by
wonjunl2
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
ae117ea6
No related branches found
No related tags found
1 merge request
!4
Draft: Wonjunl2 11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/test.py
+38
-0
38 additions, 0 deletions
Code/test.py
with
38 additions
and
0 deletions
Code/test.py
0 → 100644
+
38
−
0
View file @
17005a47
# import serial
# from serial import Serial
# ser = serial.Serial('/dev/ttyUSB0') # open serial port
# print(ser.name) # check which port was really used
# ser.write(b'hello') # write a string
# ser.readline(1000)
# ser.close() # close port
import
serial
import
time
arduino
=
serial
.
Serial
(
port
=
'
/dev/cu.usbmodem14101
'
,
baudrate
=
115200
,
timeout
=
.
1
)
def
read_data
():
time
=
0
voltage
=
0
current
=
0
data
=
arduino
.
read
(
6
)
data_arr
=
[]
for
byte
in
data
:
data_arr
.
append
(
byte
)
if
len
(
data_arr
!=
0
)
time
=
(
data_arr
[
0
]
<<
8
)
+
data_arr
[
1
]
voltage
=
(
data_arr
[
2
]
<<
8
)
+
data_arr
[
3
]
current
=
(
data_arr
[
4
]
<<
8
)
+
data_arr
[
5
]
return
len
(
data_arr
),
time
,
float
(
voltage
/
1000.0
),
float
(
current
/
1000.0
)
# while True:
# # num = input("Enter a number: ")
# num_bytes, time, voltage, current = write_read()
# # a = write_read()
# if num_bytes != 0:
# print("Time: {}, Volts: {}, Amps: {}".format(time, voltage, current))
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