You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/modules/tmr.md
+14-20Lines changed: 14 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,23 +9,17 @@ It is aimed at setting up regularly occurring tasks, timing out operations, and
9
9
10
10
What the tmr module is *not* however, is a time keeping module. While most timeouts are expressed in milliseconds or even microseconds, the accuracy is limited and compounding errors would lead to rather inaccurate time keeping. Consider using the [rtctime](rtctime.md) module for "wall clock" time.
11
11
12
-
NodeMCU provides 7 static timers, numbered 0-6, and dynamic timer creation function [`tmr.create()`](#tmrcreate).
13
-
14
-
!!! attention
15
-
16
-
Static timers are deprecated and will be removed later. Use the OO API initiated with [`tmr.create()`](#tmrcreate).
17
-
18
12
## tmr.alarm()
19
13
20
14
This is a convenience function combining [`tmr.register()`](#tmrregister) and [`tmr.start()`](#tmrstart) into a single call.
21
15
22
16
To free up the resources with this timer when done using it, call [`tmr.unregister()`](#tmrunregister) on it. For one-shot timers this is not necessary, unless they were stopped before they expired.
23
17
24
18
#### Syntax
25
-
`tmr.alarm([id/ref], interval_ms, mode, func())`
19
+
`tmr.alarm(ref, interval_ms, mode, func())`
26
20
27
21
#### Parameters
28
-
-`id`/`ref` timer id (0-6) or object, obsolete for OO API (→ [`tmr.create()`](#tmrcreate))
22
+
-`ref` timer object
29
23
-`interval_ms` timer interval in milliseconds. Maximum value is 6870947 (1:54:30.947).
30
24
-`mode` timer mode:
31
25
- `tmr.ALARM_SINGLE` a one-shot alarm (and no need to call [`tmr.unregister()`](#tmrunregister))
@@ -113,10 +107,10 @@ tmr.delay(100)
113
107
Changes a registered timer's expiry interval.
114
108
115
109
#### Syntax
116
-
`tmr.interval([id/ref], interval_ms)`
110
+
`tmr.interval(ref, interval_ms)`
117
111
118
112
#### Parameters
119
-
-`id`/`ref` timer id (0-6) or object, obsolete for OO API (→ [`tmr.create()`](#tmrcreate))
113
+
-`ref` timer object
120
114
-`interval_ms` new timer interval in milliseconds. Maximum value is 6870947 (1:54:30.947).
121
115
122
116
#### Returns
@@ -156,10 +150,10 @@ Configures a timer and registers the callback function to call on expiry.
156
150
To free up the resources with this timer when done using it, call [`tmr.unregister()`](#tmrunregister) on it. For one-shot timers this is not necessary, unless they were stopped before they expired.
0 commit comments