-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathpython-driver.py
More file actions
65 lines (50 loc) · 994 Bytes
/
python-driver.py
File metadata and controls
65 lines (50 loc) · 994 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import serial
import time
ser = serial.Serial('COM3', 9600)
def TurnRight():
ser.write('1F')
def TurnLeft():
ser.write('1F')
def Forward():
print("Forward");
ser.write('1F2F')
def Reverse():
ser.write('1R2F')
def Stop():
ser.write('S')
def Flush():
print("Flush")
ser.write('\n')
def RotateRight():
print("RotateRight")
ser.write('1R2F')
def RotateLeft():
print("RotateLeft")
ser.write('1F2R')
def Figure8():
direction = 0
print("Figure8\n")
for x in range(4) :
Forward()
Flush()
time.sleep(1)
RotateRight()
Flush()
time.sleep(0.5)
# while direction < 100:
# Forward()
# time.sleep(1)
# RotateRight()
# FlushDirections()
#while direction < 100:
# Forward()
# time.sleep(1)
# RotateLeft()
# FlushDirections()
Stop()
Flush()
if __name__ == '__main__':
ser.write('S')
Figure8()
Stop();
ser.close()