-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
59 lines (50 loc) · 1.36 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
#solenerotech.wordpress.com
#solenerotech 2013.09.06
from motor import motor
mymotor1 = motor('m1', 17, simulation=False)
mymotor2 = motor('m1', 18, simulation=False)
#where 17 is GPIO17 = pin 11
print('***Disconnect ESC power')
print('***then press ENTER')
res = raw_input()
mymotor1.start()
mymotor2.start()
mymotor1.setW(100)
mymotor2.setW(100)
#NOTE:the angular motor speed W can vary from 0 (min) to 100 (max)
#the scaling to pwm is done inside motor class
print('***Connect ESC Power')
print('***Wait beep-beep')
print('***then press ENTER')
res = raw_input()
mymotor1.setW(0)
mymotor2.setW(0)
print('***Wait N beep for battery cell')
print('***Wait beeeeeep for ready')
print('***then press ENTER')
res = raw_input()
print ('increase > a | decrease > z | save Wh > n | set Wh > h|quit > 9')
cycling = True
try:
while cycling:
res = raw_input()
if res == 'a':
mymotor1.increaseW(10)
mymotor2.increaseW(10)
if res == 'z':
mymotor1.decreaseW(10)
mymotor2.decreaseW(10)
if res == 'n':
mymotor1.saveWh()
mymotor2.saveWh()
if res == 'h':
mymotor1.setWh()
mymotor2.setWh()
if res == '9':
cycling = False
finally:
# shut down cleanly
mymotor1.stop()
mymotor2.stop()
print ("well done!")