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
coon
firmware
Commits
9568ea17
Commit
9568ea17
authored
5 years ago
by
norpol
Browse files
Options
Downloads
Patches
Plain Diff
Refactor
parent
dbea1e86
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
+8
-14
8 additions, 14 deletions
pycardium/modules/py/smooth_vibrate.py
with
8 additions
and
14 deletions
pycardium/modules/py/smooth_vibrate.py
+
8
−
14
View file @
9568ea17
...
@@ -2,16 +2,7 @@ import vibra
...
@@ -2,16 +2,7 @@ import vibra
import
utime
import
utime
def
vi
(
dur
,
sle
):
def
vibrate
(
times
=
None
,
dur
=
None
,
sle
=
None
):
"""
helper for repeater()
see repeater() params
"""
vibra
.
vibrate
(
dur
)
utime
.
sleep_ms
(
sle
)
def
repeater
(
times
,
dur
,
sle
):
"""
"""
trigger vibration motor with three values
trigger vibration motor with three values
times => how often we should triger
times => how often we should triger
...
@@ -21,8 +12,11 @@ def repeater(times, dur, sle):
...
@@ -21,8 +12,11 @@ def repeater(times, dur, sle):
combination out of this creates a fake PWM
combination out of this creates a fake PWM
that enables easy and smooth vibrations
that enables easy and smooth vibrations
"""
"""
times
=
times
or
1
for
i
in
range
(
times
):
for
i
in
range
(
times
):
vi
(
dur
,
sle
)
vibra
.
vibrate
(
dur
)
utime
.
sleep_ms
(
sle
)
def
simple
():
def
simple
():
...
@@ -30,7 +24,7 @@ def simple():
...
@@ -30,7 +24,7 @@ def simple():
simple() is a short way of vibration
simple() is a short way of vibration
for example for button push/change status suitable
for example for button push/change status suitable
"""
"""
repe
ate
r
(
5
,
5
,
10
)
vibr
ate
(
5
,
5
,
10
)
def
select
():
def
select
():
...
@@ -38,7 +32,7 @@ def select():
...
@@ -38,7 +32,7 @@ def select():
select() is a little longer, but smoother
select() is a little longer, but smoother
good for communicating something got selected
good for communicating something got selected
"""
"""
repe
ate
r
(
10
,
5
,
20
)
vibr
ate
(
10
,
5
,
20
)
def
pattern
(
n
=
None
):
def
pattern
(
n
=
None
):
...
@@ -48,4 +42,4 @@ def pattern(n=None):
...
@@ -48,4 +42,4 @@ def pattern(n=None):
n = 2 and n = 1 feels the same
n = 2 and n = 1 feels the same
"""
"""
n
=
n
or
3
n
=
n
or
3
repe
ate
r
(
n
,
20
,
100
)
vibr
ate
(
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