User Tools

Site Tools

한국어

logicpython:cubloc_api:ontimer

This is an old revision of the document!


OnTimer

Register a periodic timer callback using CUBLOC OnTimer semantics.

Syntax

from cubloc import OnTimer
 
OnTimer(interval: int, callback: object)

Parameters

  • interval: Timer interval in 10 ms units (1 to 65535).
  • callback: Callable invoked on each timer period.

Exceptions

  • TypeError: interval is not an integer or callback is not callable.
  • ValueError: interval is outside the supported range.
  • RuntimeError: Timer initialization failed.

Example

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)
logicpython/cubloc_api/ontimer.1775786798.txt.gz · Last modified: by 127.0.0.1