-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcmd.py
More file actions
executable file
·30 lines (25 loc) · 579 Bytes
/
Copy pathcmd.py
File metadata and controls
executable file
·30 lines (25 loc) · 579 Bytes
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
#!/usr/bin/python3
import serial
import binascii
import sys
ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1) # open serial port
def cmd(command):
res = []
ser.write(command)
while True:
s = ser.read(13)
if (s == b''):
break
print(binascii.hexlify(s, ' '))
res.append(s)
return res
def get_cell_v(cell_count):
command = sys.argv[1]
ser.write(command)
while True:
s = ser.read(13)
if (s == b''):
break
print(binascii.hexlify(s, ' '))
ser.close()
print('done')