Skip to content

Commit 89a255d

Browse files
Update ex1_qwiic_scmd.py
Zero motors if they are running and change limits into proper range (0-254)
1 parent 5cc780d commit 89a255d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

examples/ex1_qwiic_scmd.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ def runExample():
6060
myMotor.begin()
6161
print("Motor initialized.")
6262
time.sleep(.250)
63+
64+
# Zero Motor Speeds
65+
myMotor.set_drive(0,0,0)
66+
myMotor.set_drive(1,0,0)
67+
6368
myMotor.enable()
6469
print("Motor enabled")
6570
time.sleep(.250)
@@ -71,7 +76,7 @@ def runExample():
7176
print(speed)
7277
myMotor.set_drive(R_MTR,FWD,speed)
7378
time.sleep(.05)
74-
for speed in range(255,20, -1):
79+
for speed in range(254,20, -1):
7580
print(speed)
7681
myMotor.set_drive(R_MTR,FWD,speed)
7782
time.sleep(.05)
@@ -82,4 +87,4 @@ def runExample():
8287
except (KeyboardInterrupt, SystemExit) as exErr:
8388
print("Ending example.")
8489
myMotor.disable()
85-
sys.exit(0)
90+
sys.exit(0)

0 commit comments

Comments
 (0)