Home AMX User Forum NetLinx Studio

visual countdown timer on touch panel

Can anyone recommend a method for creating a countdown timer on a touch panel. I'm using an AXT-CA10 and Axcent3 controller. Some sample code would be greatly appreciated! I would like to use this as a visual feedback while a projector is warming up and cooling down.
Eric

Comments

  • Jimweir192Jimweir192 Posts: 502
    In Axcent I used to use a level and a bargraph across the width of the page and reduce the value in mainline using a wait, but there are other ways too
  • Timelines are your friend to do this. See code below for one way to do it.
    define_constant
    
    TL_Countdown = 1 //make sure you change this to whatever works in your system if you have other timelines you use
    
    define_variable
    
    long lTL_countdowntimes[] = {1000} //1 second, could make this longer or shorter if you wanted to
    
    define_event
    button_event[dvTP,timeline_start]
    {
         push:
         {
              timeline_create(TL_Countdown,lTL_countdowntimes,1,timeline_relative,timeline_repeat)
         }
    }
    timeline_event[TL_Countdown]
    {
         stack_var integer nCountdownLength
    
         nCountdownLength = 30
    
         send_command dvTP, "'^TXT,1,0,'ATOI(nCountdownLength-timeline.repetition),' seconds remaining'"
    
         if(timeline.repetition x timeline.time > nCountdownLength x 1000)
         {
               timeline_kill(TL_Countdown)
         }
    }
    

    That should work, haven't tested it and wrote it off the top of my head.
  • truetrue Posts: 307
    Andrew G Welker, this is Axcent he is talking about, not NetLinx =)

    (also you have syntax errors ;p)
  • TurnipTruckTurnipTruck Posts: 1,485
    DEFINE_PROGRAM
    nTiming++
    IF nCountdown=0
      nCountdown=100
    IF (nTiming=100)
      {
      nTiming=0
      nCoutndown--
      SEND_COMMAND dvTP,"I forget the G3 comand,ITOA(nCountdown)"
      }
    nTiming++
    

    Completely untested. Hopefully this gets you started.
  • Thomas HayesThomas Hayes Posts: 1,164
    ***Put this in variable section***
    INTEGER COUNTTIMER_W
    INTEGER BARGRAPH_WARM
    INTEGER COUNTTIMER_C
    INTEGER BARGRAPH_COOL
    *** Put this in program section***
    // System Warm Up Timer and Bargraph Display
    IF ((CountTimer_W <>999) and (CountTimer_W <40)) // second number is time to count up to
    {
    WAIT 10 // updates every second
    {
    CountTimer_W= CountTimer_W+1
    SEND_LEVEL VTP , 3, COUNTTIMER_W
    IF (CountTimer_W=40)
    {
    CountTimer_W=999 // stop counter
    nSystem_Warm=1
    WAIT 20
    nSystem_Warm=0
    SEND_LEVEL VTP, 3, 0
    }
    }
    }

    // System Cool Down Timer and Bargrahp Dispaly
    IF ((CountTimer_C <>999) and (CountTimer_C <=120)) // second number is time to count up to
    {
    WAIT 10 // updates every second
    {
    CountTimer_C= CountTimer_C+1
    SEND_LEVEL VTP , 4, COUNTTIMER_C
    IF(COUNTTIMER_C=30)
    {
    PULSE[dvScr1,Scr1_Stop]
    PULSE[dvScr2,Scr2_Stop]
    }
    IF(COUNTTIMER_C=120)
    {
    CountTimer_C=999 // stop counter
    nSystem_Cool=1
    WAIT 20
    nSystem_Cool=0
    SEND_LEVEL VTP, 4, 0
    }
    }
    }

    I use this code in all of my older units and have never had an issue. The only thing I have every found is not to have any other functions going on during the process because it might miss it.
  • trx250r87trx250r87 Posts: 31
    timer

    Thanks guys, I'll give some of these a try...
    Eric
  • trx250r87trx250r87 Posts: 31
    This looks like it is for Nexlinx, would you mind converting it to Axcent3?
    Eric


    ***Put this in variable section***
    INTEGER COUNTTIMER_W
    INTEGER BARGRAPH_WARM
    INTEGER COUNTTIMER_C
    INTEGER BARGRAPH_COOL
    *** Put this in program section***
    // System Warm Up Timer and Bargraph Display
    IF ((CountTimer_W <>999) and (CountTimer_W <40)) // second number is time to count up to
    {
    WAIT 10 // updates every second
    {
    CountTimer_W= CountTimer_W+1
    SEND_LEVEL VTP , 3, COUNTTIMER_W
    IF (CountTimer_W=40)
    {
    CountTimer_W=999 // stop counter
    nSystem_Warm=1
    WAIT 20
    nSystem_Warm=0
    SEND_LEVEL VTP, 3, 0
    }
    }
    }

    // System Cool Down Timer and Bargrahp Dispaly
    IF ((CountTimer_C <>999) and (CountTimer_C <=120)) // second number is time to count up to
    {
    WAIT 10 // updates every second
    {
    CountTimer_C= CountTimer_C+1
    SEND_LEVEL VTP , 4, COUNTTIMER_C
    IF(COUNTTIMER_C=30)
    {
    PULSE[dvScr1,Scr1_Stop]
    PULSE[dvScr2,Scr2_Stop]
    }
    IF(COUNTTIMER_C=120)
    {
    CountTimer_C=999 // stop counter
    nSystem_Cool=1
    WAIT 20
    nSystem_Cool=0
    SEND_LEVEL VTP, 4, 0
    }
    }
    }

    I use this code in all of my older units and have never had an issue. The only thing I have every found is not to have any other functions going on during the process because it might miss it.
  • true wrote: »
    Andrew G Welker, this is Axcent he is talking about, not NetLinx =)

    (also you have syntax errors ;p)

    Oops, neeed to read a little closer...and put my code in Netlinx studio first ;)
  • Thomas HayesThomas Hayes Posts: 1,164
    trx250r87 wrote: »
    This looks like it is for Nexlinx, would you mind converting it to Axcent3?
    Eric

    I use it with Axcent III and Netlinx. It should work as it is for Axcecnt III. The VTP is just a device name but can be changed to TP.
Sign In or Register to comment.