Results 1 to 3 of 3

Thread: Delay Timer Function

  1. #1
    Join Date
    Apr 2004
    Location
    Dearborn, MI
    Posts
    1,968

    Default Delay Timer Function

    Well one function I use a lot is a delay timer. Nice thing is it will not hold up anything waiting around for a delay. Basic structure I use is as follows:

    -- myDED and delayedFunc are any names you want

    local function delayedFunc ()

    -- This function will execute 60 seconds after so
    -- do what you want after the delay here

    end

    -- do what you want before the delay here

    Voice:Speak('This will play first and then after 60 seconds the other function will run')

    -- kills any current delay timer... basically resets the delay

    if myDED then -- kills an existing dispatcher
    myDED:Close ()
    myDED = nil
    end

    -- time is milliseconds so this would be 1 minute

    -- setup new delay function. It will execute the 'delayedFunc' in 60 seconds

    myDED = Classes.DelayedExecutionDispatcher:New (60000,delayedFunc)
    John

    Now Playing skin creator

    Girder 5.0 / Elk-M1EZ8 / Ocelot / SECU-16IR /SECU-16I / SECU-16 / BobCat Humidity
    JRMC 11.1 / M-Audio Delta 410 / Xitel HIFI Pro / Xitel HIFI Link
    NetRemote 2.0 / 6 Zone whole house audio delivering 1580 watts RMS total
    ELO 15" Touchscreen, Nokia 770 and Advent 3500PC Mobile PC 7" TS
    Droid 2 Global

    Click here to visit my Nowplaying Showcase Blog

  2. #2
    Join Date
    Jun 2005
    Location
    Vancouver Canada
    Posts
    323

    Default

    Hi John

    i was wondering if you can make this trigger something at say the
    40 sec mark then the 30 sec mark of the count down

    paul

  3. #3
    Join Date
    Apr 2004
    Location
    Dearborn, MI
    Posts
    1,968

    Default

    Well you could always just create different delayed functions. I don't think you have any way of reading the remaining time left on the timer. One thing I do for my motion sensor delayed light turn off is to setup a delay then when the delay ends check to see if there is still motion by reading the 'not ready' status of the Elk motion sensor and if its still 'violated' then just reset the delay again. Your not limited to a single delay timer so just use your imagination.
    John

    Now Playing skin creator

    Girder 5.0 / Elk-M1EZ8 / Ocelot / SECU-16IR /SECU-16I / SECU-16 / BobCat Humidity
    JRMC 11.1 / M-Audio Delta 410 / Xitel HIFI Pro / Xitel HIFI Link
    NetRemote 2.0 / 6 Zone whole house audio delivering 1580 watts RMS total
    ELO 15" Touchscreen, Nokia 770 and Advent 3500PC Mobile PC 7" TS
    Droid 2 Global

    Click here to visit my Nowplaying Showcase Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •