Skip to content

Commit b89e652

Browse files
authored
Merge pull request #14 from caternuson/iss13
Sure, loop on all 123.
2 parents 48ba4ab + 098b3bd commit b89e652

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

examples/drv2605_simpletest.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Simple demo of the DRV2605 haptic feedback motor driver.
2-
# Will play all 117 effects in order for about a half second each.
2+
# Will play all 123 effects in order for about a half second each.
33
# Author: Tony DiCola
44
import time
55

@@ -13,7 +13,7 @@
1313
i2c = busio.I2C(board.SCL, board.SDA)
1414
drv = adafruit_drv2605.DRV2605(i2c)
1515

16-
# Main loop runs forever trying each effect (1-117).
16+
# Main loop runs forever trying each effect (1-123).
1717
# See table 11.2 in the datasheet for a list of all the effect names and IDs.
1818
# http://www.ti.com/lit/ds/symlink/drv2605.pdf
1919
effect_id = 1
@@ -25,9 +25,10 @@
2525
# slot number 0 to 6.
2626
# Optionally, you can assign a pause to a slot. E.g.
2727
# drv.sequence[1] = adafruit_drv2605.Pause(0.5) # Pause for half a second
28-
drv.play() # Play the effect.
29-
time.sleep(0.5)
28+
drv.play() # play the effect
29+
time.sleep(0.5) # for 0.5 seconds
30+
drv.stop() # and then stop (if it's still running)
3031
# Increment effect ID and wrap back around to 1.
3132
effect_id += 1
32-
if effect_id > 117:
33+
if effect_id > 123:
3334
effect_id = 1

0 commit comments

Comments
 (0)