diff --git a/pycardium/modules/py/smooth_vibrate.py b/pycardium/modules/py/smooth_vibrate.py index 7aa28119ff4de2cf8135799605dbfafa1d5ed839..915d27ada76092f07b64ac5356d9095ebf1d1bd9 100644 --- a/pycardium/modules/py/smooth_vibrate.py +++ b/pycardium/modules/py/smooth_vibrate.py @@ -2,16 +2,7 @@ import vibra import utime -def vi(dur, sle): - """ - helper for repeater() - see repeater() params - """ - vibra.vibrate(dur) - utime.sleep_ms(sle) - - -def repeater(times, dur, sle): +def vibrate(times=None, dur=None, sle=None): """ trigger vibration motor with three values times => how often we should triger @@ -21,8 +12,11 @@ def repeater(times, dur, sle): combination out of this creates a fake PWM that enables easy and smooth vibrations """ + times = times or 1 + for i in range(times): - vi(dur, sle) + vibra.vibrate(dur) + utime.sleep_ms(sle) def simple(): @@ -30,7 +24,7 @@ def simple(): simple() is a short way of vibration for example for button push/change status suitable """ - repeater(5, 5, 10) + vibrate(5, 5, 10) def select(): @@ -38,7 +32,7 @@ def select(): select() is a little longer, but smoother good for communicating something got selected """ - repeater(10, 5, 20) + vibrate(10, 5, 20) def pattern(n=None): @@ -48,4 +42,4 @@ def pattern(n=None): n = 2 and n = 1 feels the same """ n = n or 3 - repeater(n, 20, 100) + vibrate(n, 20, 100)