Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions examples/drv2605_simpletest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Simple demo of the DRV2605 haptic feedback motor driver.
# Will play all 117 effects in order for about a half second each.
# Will play all 123 effects in order for about a half second each.
# Author: Tony DiCola
import time

Expand All @@ -13,7 +13,7 @@
i2c = busio.I2C(board.SCL, board.SDA)
drv = adafruit_drv2605.DRV2605(i2c)

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