Simulation Instruments

Home›All functions›Timer

Timer

Simulation Instrument Studio 1

timer_start

Simulation Instrument Studio 1

Definition

timer_id = timer_start(delay, period, callback_function)

Remarks

Start a timer which will call a function at a given interval. Delay is initial delay, period is repeat interval (ms).

Example

No sample instrument calls this yet.

timer_start()

Example: once, and every half second

-- Once, a second after launch
timer_start(1000, function()
    log("warmup done")
end)

-- Every half second. count is how many times it has fired.
blink = timer_start(0, 500, function(count)
    visible(fail_lamp, count % 2 == 0)
end)
Photo slot: shots/timer_start.png

timer_stop

Simulation Instrument Studio 1

Definition

timer_stop(timer_id)

Remarks

Stop a timer.

Parameters

NameDescription
timer_idId returned by the call that created the object.

Example

No sample instrument calls this yet.

timer_stop(timer_id)
Photo slot: shots/timer_stop.png

timer_running

Simulation Instrument Studio 1

Definition

running = timer_running(timer_id)

Remarks

Check if a timer is still running.

Example

No sample instrument calls this yet.

timer_running()
Photo slot: shots/timer_running.png