WiFiMCU Reference Book

Function List

Function Definition
tmr.start() Start a timer with call back function
tmr.stop() Stop a timer
tmr.stopall() Stop all the timer
tmr.tick() Get the current time tick of the MCU (ms) since startup
tmr.delayms() Delay for a assigned time in micro senconds
tmr.wdclr() Clear the Independent watchdog counter

tmr.start()

Description

Start a timer with call back function.

Syntax

tmr.start(tmrID, interval, func_cb)

Parameters

tmrID: timer ID, 0~15. 16 timers are supported at present

interval: interval time for the timer

func_cb: Callback function for the timer

Returns

nil

Examples

-tmr.start(1,1000,function() print("tmr1 is called") end)

-tmr1 is called

tmr1 is called

tmr1 is called

tmr.stop()

Description

Stop a timer

Syntax

tmr.stop(tmrID)

Parameters

tmrID: timer ID, 0~15

Returns

nil

Examples

-tmr.start(1,1000,function() print("tmr1 is called") end)

-tmr1 is called

tmr1 is called

tmr1 is called

-tmr. stop(1)

tmr.stopall()

Description

Stop all the timer.

Syntax

tmr.stopall(tmrID)

Parameters

nil

Returns

nil

Examples

-tmr. stopall()

tmr.tick()

Description

Get the current time tick of the MCU (ms) since startup.

Syntax

tick=tmr.tick()

Parameters

nil

Returns

nil

Examples

-print(tmr.tick())

1072237

tmr.delayms()

Description

Delay for a assigned time in micro seconds.

Syntax

tmr.delayms(ms)

Parameters

ms: The delay time in micro seconds

Returns

nil

Examples

-tmr.delayms(1000)

tmr.wdclr()

Description

Clear the independent watchdog counter. The default independent watchdog time is 10 senconds.

Note: This function should be called if some operations cost over 10 seconds.

Syntax

tmr. wdclr ()

Parameters

nil

Returns

nil

Examples

-tmr.wdclr()