Skip to content

Commit 182b028

Browse files
committed
lint
1 parent a4ab8ea commit 182b028

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

examples/DualStepperTest.py

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import atexit
77
import threading
88
import random
9-
from adafruit_motorkit import MotorKit
109
from adafruit_motor import stepper as STEPPER
10+
from adafruit_motorkit import MotorKit
1111

1212
# create a default object, no changes to I2C address or frequency
1313
kit = MotorKit()
@@ -31,33 +31,39 @@ def stepper_worker(stepper, numsteps, direction, style):
3131
stepper.onestep(direction=direction, style=style)
3232
#print("Done")
3333

34-
while (True):
34+
while True:
3535
if not st1.isAlive():
3636
randomdir = random.randint(0, 1)
37-
print("Stepper 1"),
38-
if (randomdir == 0):
39-
dir = STEPPER.FORWARD
40-
print("forward"),
37+
print("Stepper 1")
38+
if randomdir == 0:
39+
direction = STEPPER.FORWARD
40+
print("forward")
4141
else:
42-
dir = STEPPER.BACKWARD
43-
print("backward"),
42+
direction = STEPPER.BACKWARD
43+
print("backward")
4444
randomsteps = random.randint(10,50)
4545
print("%d steps" % randomsteps)
46-
st1 = threading.Thread(target=stepper_worker, args=(kit.stepper1, randomsteps, dir, stepstyles[random.randint(0,3)],))
46+
st1 = threading.Thread(target=stepper_worker, args=(kit.stepper1,
47+
randomsteps,
48+
direction,
49+
stepstyles[random.randint(0,3)],))
4750
st1.start()
4851

4952
if not st2.isAlive():
50-
print("Stepper 2"),
53+
print("Stepper 2")
5154
randomdir = random.randint(0, 1)
52-
if (randomdir == 0):
53-
dir = STEPPER.FORWARD
54-
print("forward"),
55+
if randomdir == 0:
56+
direction = STEPPER.FORWARD
57+
print("forward")
5558
else:
56-
dir = STEPPER.BACKWARD
57-
print("backward"),
59+
direction = STEPPER.BACKWARD
60+
print("backward")
5861
randomsteps = random.randint(10,50)
5962
print("%d steps" % randomsteps)
60-
st2 = threading.Thread(target=stepper_worker, args=(kit.stepper2, randomsteps, dir, stepstyles[random.randint(0,3)],))
63+
st2 = threading.Thread(target=stepper_worker, args=(kit.stepper2,
64+
randomsteps,
65+
direction,
66+
stepstyles[random.randint(0,3)],))
6167
st2.start()
6268

6369
time.sleep(0.1) # Small delay to stop from constantly polling threads (see: https://forums.adafruit.com/viewtopic.php?f=50&t=104354&p=562733#p562733)

0 commit comments

Comments
 (0)