-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.py
45 lines (36 loc) · 870 Bytes
/
test.py
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
36
37
38
39
40
41
42
43
44
import serial
import time
ser = serial.Serial('/dev/ttyACM0', 115200, timeout=1)
time.sleep(0.1)
string = ("par angleOffsetPitch")
print(string)
ser.write(bytearray(string, 'ascii'))
time.sleep(1)
ser.flushInput()
incoming = ser.readline().decode('utf-8')
print(incoming)
incoming = incoming.strip()
print(incoming)
incoming = incoming.split(" ")
print(incoming)
incoming = incoming[1]
incoming = int(incoming)
print (incoming)
string = ("par angleOffsetRoll")
print(string)
ser.write(bytearray(string, 'ascii'))
time.sleep(1)
ser.flushInput()
incoming = ser.readline().decode('utf-8')
print(incoming)
incoming = incoming.strip()
print(incoming)
incoming = incoming.split(" ")
print(incoming)
incoming = incoming[1]
incoming = int(incoming)
print (incoming)
#string = incoming.split(" ")
#current_y = string[1]
#current_y = int(current_y)
#print (10*current_y)