-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathAllMotorTest.py
64 lines (57 loc) · 2.49 KB
/
AllMotorTest.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
58
59
60
61
62
63
64
#AllMotorTest.py
# test code that ramps each motor 0-100-0 then changes direction and does it again.
#all motors run at once, but with staggered timings
import PicoRobotics
import utime
board = PicoRobotics.KitronikPicoRobotics()
directions = ["f","r"]
while True:
for direction in directions:
for speed in range(0,25):
board.motorOn(1, direction, speed)
board.motorOn(2, direction, 25-speed)
board.motorOn(3, direction, 50-speed)
board.motorOn(4, direction, 75-speed)
utime.sleep_ms(100) #ramp speed over 25x100ms => approx 2.5 second.
for speed in range(0,25):
board.motorOn(1, direction, 25+speed)
board.motorOn(2, direction, speed)
board.motorOn(3, direction, 25-speed)
board.motorOn(4, direction, 50-speed)
utime.sleep_ms(100)
for speed in range(0,25):
board.motorOn(1, direction, 50+speed)
board.motorOn(2, direction, 25+speed)
board.motorOn(3, direction, speed)
board.motorOn(4, direction, 25-speed)
utime.sleep_ms(100)
for speed in range(0,25):
board.motorOn(1, direction, 75+speed)
board.motorOn(2, direction, 50+speed)
board.motorOn(3, direction, 25+speed)
board.motorOn(4, direction, speed)
utime.sleep_ms(100)
for speed in range(0,25):
board.motorOn(1, direction, 100-speed)
board.motorOn(2, direction, 75+speed)
board.motorOn(3, direction, 50+speed)
board.motorOn(4, direction, 25+speed)
utime.sleep_ms(100)
for speed in range(0,25):
board.motorOn(1, direction, 75-speed)
board.motorOn(2, direction, 100-speed)
board.motorOn(3, direction, 75+speed)
board.motorOn(4, direction, 50+speed)
utime.sleep_ms(100)
for speed in range(0,25):
board.motorOn(1, direction, 50-speed)
board.motorOn(2, direction, 75-speed)
board.motorOn(3, direction, 100-speed)
board.motorOn(4, direction, 75+speed)
utime.sleep_ms(100)
for speed in range(0,25):
board.motorOn(1, direction, 25-speed)
board.motorOn(2, direction, 50-speed)
board.motorOn(3, direction, 75-speed)
board.motorOn(4, direction, 100-speed)
utime.sleep_ms(100)