User Tools

Site Tools

한국어

logicpython:cubloc_api:ontimer

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

logicpython:cubloc_api:ontimer [2026/04/10 02:06] – created - external edit 127.0.0.1logicpython:cubloc_api:ontimer [2026/04/10 06:11] (current) – removed mfranklin
Line 1: Line 1:
-====== OnTimer ====== 
- 
-Register a periodic timer ''callback'' using CUBLOC ''OnTimer'' semantics. 
- 
-===== Syntax ===== 
- 
-<code python> 
-from cubloc import OnTimer 
- 
-OnTimer(interval: int, callback: object) 
-</code> 
- 
-===== Parameters ===== 
- 
-  * **interval**: Timer ''interval'' in 10 ms units (1 to 65535). 
-  * **callback**: Callable invoked on each timer period. 
- 
-===== Exceptions ===== 
- 
-  * [[https://docs.micropython.org/en/latest/library/builtins.html#TypeError|TypeError]]: ''interval'' is not an integer or ''callback'' is not callable. 
-  * [[https://docs.micropython.org/en/latest/library/builtins.html#ValueError|ValueError]]: ''interval'' is outside the supported range. 
-  * [[https://docs.micropython.org/en/latest/library/builtins.html#RuntimeError|RuntimeError]]: Timer initialization failed. 
- 
-===== Example ===== 
- 
-<code python> 
-from cubloc import OnTimer, Debug, CR 
- 
-def timer_handler(): 
-    Debug("Timer tick", CR) 
- 
-# 100 ticks x 10 ms = 1000 ms (1 second) 
-OnTimer(100, timer_handler) 
-</code> 
- 
-===== Related APIs ===== 
- 
-  * [[logicpython:cubloc_api:delay|Delay]] 
-  * [[logicpython:cubloc_api:pause|Pause]] 
-  * [[logicpython:cubloc_api:setontimer|SetOnTimer]] 
-  * [[logicpython:cubloc_api:udelay|UDelay]] 
-  * [[logicpython:cubloc_api:wait|Wait]] 
  
logicpython/cubloc_api/ontimer.1775786798.txt.gz · Last modified: by 127.0.0.1