Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
François Revol
firmware
Commits
b6e4759d
Commit
b6e4759d
authored
5 years ago
by
norpol
Browse files
Options
Downloads
Patches
Plain Diff
Improve documentation
parent
9568ea17
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pycardium/modules/py/smooth_vibrate.py
+9
-7
9 additions, 7 deletions
pycardium/modules/py/smooth_vibrate.py
with
9 additions
and
7 deletions
pycardium/modules/py/smooth_vibrate.py
+
9
−
7
View file @
b6e4759d
...
...
@@ -2,12 +2,12 @@ import vibra
import
utime
def
vibrate
(
times
=
None
,
dur
=
None
,
sle
=
None
):
def
vibrate
(
times
=
None
,
dur
ation
=
None
,
sle
ep
=
None
):
"""
trigger vibration motor with three values
times
=>
how often we should triger
dur =>
how long should we trigger for each iteration
sle =>
how long should we wait in between
:param int
times
:
how often we should trig
g
er
:param int duration:
how long should we trigger for each iteration
(ms)
:param int sleep:
how long should we wait in between
(ms)
combination out of this creates a fake PWM
that enables easy and smooth vibrations
...
...
@@ -15,8 +15,8 @@ def vibrate(times=None, dur=None, sle=None):
times
=
times
or
1
for
i
in
range
(
times
):
vibra
.
vibrate
(
dur
)
utime
.
sleep_ms
(
sle
)
vibra
.
vibrate
(
dur
ation
)
utime
.
sleep_ms
(
sle
ep
)
def
simple
():
...
...
@@ -37,9 +37,11 @@ def select():
def
pattern
(
n
=
None
):
"""
:param int n: how often to repeat the pattern
n = 2 and n = 1 feels the same
very distinctive but long pattern
feels like duk-duk-duk
n = 2 and n = 1 feels the same
"""
n
=
n
or
3
vibrate
(
n
,
20
,
100
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment