Home AMX User Forum AMX Technical Discussion

How do I make and event happen at a set time each day

julianjulian Junior MemberPosts: 13
Hi i am looking to use the onboard clock to make an event happen at a set time ie. turn projector on a 8am and switch off again at 11pm.

Comments

  • ColzieColzie Senior Member Posts: 470

    TIME
    This system variable holds the current time as a string in the form "hh:mm:ss".

    The time is represented in 24-hour format.

    TIME_TO_HOUR
    Returns an integer representing the hour portion of a time string.

    TIME_TO_HOUR (TIME) will give you the current hour.
  • ColzieColzie Senior Member Posts: 470
    An easy way to trigger the event is to use DEFINE_PROGRAM
    DEFINE_PROGRAM
    
    IF (TIME == '23:59:59')
    {
      //  do something
    }
    
    
  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,177
    Colzie wrote: »
    An easy way to trigger the event is to use DEFINE_PROGRAM
    DEFINE_PROGRAM
    
    IF (TIME == '23:59:59')
    {
      //  do something
    }
    
    

    Another thing to remember that it will be 23:59:59 for several thousand program cycles.

    It might be a good thing to put a trap in it as well.
    if(time=='23:59:59 and do_it_flag=0)
    {
     do_it_flag=1
    // do something
    wait 15
      {
      do_it_flag=0
      }
    }
    
    
Sign In or Register to comment.