+ Reply to Thread
Results 1 to 8 of 8

Thread: Timer sequence

  1. #1
    Wire Noob f33b0's Avatar
    Join Date
    Mar 2009
    Posts
    14

    Default Timer sequence

    What i am trying to do is to set a timer to go then have 7 comands triger every ten digits of the timer. Each comand needs to happen and then reset to 0 by the time the next one trigers.

    Heres what i have;
    Code:
    @inputs Address
    @outputs Active 
    @persist First Second Third Fourth Fith Sixth Enter Time
    
    interval(50)
    
    if (Active == 1) {timer("go",100) }
    if (? == 10) {Address==First}
    I want it to go
    if (Active == 1) {timer("go",100) == Time}
    if (Time == 10) {Address == first}
    if (Time == 20) {Address == first}
    if (Time == 30) {Address == first}
    "and so on"
    if (Time == 80) {stoptimer("go")}
    Sadly it wont let me do this. Any help would be awsome.

  2. #2
    billywitchdoctor.com Whosdr's Avatar
    Join Date
    Dec 2008
    Posts
    2,300

    Default Re: Timer sequence

    Code:
    if (clk("go")) {
    X++
    if (X == 1) {Address = #}
    if (X == 2) {Address = #}
    if (X == 3) {Address = #}
    }
    ect
    Uh - Why has the highlight gone into one line?
    Last edited by Whosdr; 02-26-2010 at 03:10 PM.
    .siht daer ot gniyrt emit detsaw ev'uoY

  3. #3
    Wire Noob f33b0's Avatar
    Join Date
    Mar 2009
    Posts
    14

    Default Re: Timer sequence

    Highlight?
    Why is it an if statement?
    And how do i then make the clk stop?

    if (Active == 1)
    {
    if (clk("go"))
    {
    Time++
    if (Time == 10) {Address = #}
    if (Time == 20) {Address = #}
    if (Time == 30) {Address = #}
    }

    Is that right?

    Last edited by f33b0; 02-26-2010 at 02:45 PM.

  4. #4
    aka Colonel Never Online Colonel Thirty Two's Avatar
    Join Date
    Oct 2009
    Posts
    2,680
    Blog Entries
    5

    Default Re: Timer sequence

    Code:
    if(!Active)
    {
        stoptimer("go")
    }

  5. #5
    Wire Noob LightSpeed's Avatar
    Join Date
    Jan 2010
    Posts
    13

    Default Re: Timer sequence

    Is there any way to reset the timer while it is still running?

  6. #6
    Wirererer Elmo the Emo Emperor's Avatar
    Join Date
    Feb 2008
    Location
    Lagville(Austrlia)
    Posts
    278

    Default Re: Timer sequence

    stoptimer("")
    timer("")

  7. #7
    Wire Amateur Shizuka's Avatar
    Join Date
    May 2009
    Posts
    55

    Default Re: Timer sequence

    Code:
    @inputs, outputs blah blah blah
    
    timer("go", 50)
    
    if (Active & clk("go")) {
        X++
        if (X==1){foo}
        if (X==2){bar}
        ...
        if (X == some max number, like 10){stoptimer("go"), timer("go", 50), then foo}
    }
    Remember that timer() is basically just interval() with a unique name, so you'll still have to maintain a separate counter variable while the timer triggers executions.
    Last edited by Shizuka; 03-18-2010 at 07:06 PM.

  8. #8
    Wirererer jayg20769's Avatar
    Join Date
    Jun 2008
    Posts
    322

    Default Re: Timer sequence

    I never got around to using timer() but I would approach it like this:

    Code:
    interval(10000)
    
    #Your code
    This makes the E2 execute every 10 seconds. But if you need to do other things as well and this is too slow, you can do this:

    Code:
    interval(10)             #This (I think) is the fastest you can make E2 run normally
    
    Timer += 0.1
    
    if ((Timer % 10) == 0)
    {
      #Your code
    }
    This makes the timer go on forever, and every 10 seconds it will execute. You can add code so that the timer will reset it self after some time.
    Quote Originally Posted by ninjahax View Post
    i just cant them done myself

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots