Home AMX User Forum NetLinx Studio

Am I doing this right? (programmer 1 newbie)

I want to execute all this in one button push to turn a system basically can I just lay these out on a button event?

// system on routine
button_event [dvTP,10]
{
push:
{
on [dvrelay,screen_down]
wait 70
off [dvrelay,screen_down]

pulse [vdvVProj,27] //nec module (proj on)
wait 70
SEND_STRING dvSwth,'1*1!'
send_command vdvVProj, 'input-RGB,1'
}
}

Comments

  • This will execute more quickly:
    // system on routine
    BUTTON_EVENT [dvTP,10]
    {
       PUSH:
       {
          ON [dvrelay,screen_down]                        
          PULSE [vdvVProj,27]                 //nec module (proj on)
          WAIT 70
          OFF [dvrelay,screen_down]
          SEND_STRING dvSwth,'1*1!'
          SEND_COMMAND vdvVProj, 'input-RGB,1'
       }
    }
    

    --John
  • Joe HebertJoe Hebert Posts: 2,159
    This will execute more quickly:
    Yes, but it won?t do the same thing.

    Only this line of code will be delayed for 7 seconds
    off [dvrelay,screen_down]

    In the original posted code by avi_dave, these 2 lines will be delayed for 7 seconds:
    off [dvrelay,screen_down]
    SEND_STRING dvSwth,'1*1!'
    avi_dave wrote:
    Am I doing this right?
    It depends on what you want to do. The syntax is fine and the code will execute. I don?t know if it?s with the delays you expect.

    If you want to use a WAIT to act upon more than one statement (one line of code), then you need to make it a compound statement by surrounding the statements within curly braces {}.

    WAIT 70
    {
    //do this
    //do that
    //do the other thing
    }
  • Looking back at my response, I'm not even sure what question I was answering...
    // system on routine
    BUTTON_EVENT [dvTP,10]
    {
       PUSH:
       {
          ON [dvrelay,screen_down]                        
          PULSE [vdvVProj,27]                 //nec module (proj on)
          WAIT 70
          {
             OFF [dvrelay,screen_down]
             SEND_STRING dvSwth,'1*1!'
             SEND_COMMAND vdvVProj, 'input-RGB,1'
          }
       }
    }
    

    Yes you can lay it out in a button_event.

    Code above does this:
    1) Screen Down, Projector On
    2) Wait 7 seconds
    3) Send '1*1' to the switch, and change projector to RGB input

    Original Code sent the change to RGB input too quickly.

    Thanks for the catch Joe (again :)).


    --John
  • flcusatflcusat Posts: 309
    Looking back at my response, I'm not even sure what question I was answering...
    // system on routine
    BUTTON_EVENT [dvTP,10]
    {
       PUSH:
       {
          ON [dvrelay,screen_down]                        
          PULSE [vdvVProj,27]                 //nec module (proj on)
          WAIT 70
          {
             OFF [dvrelay,screen_down]
             SEND_STRING dvSwth,'1*1!'
             SEND_COMMAND vdvVProj, 'input-RGB,1'
          }
       }
    }
    

    Yes you can lay it out in a button_event.

    Code above does this:
    1) Screen Down, Projector On
    2) Wait 7 seconds
    3) Send '1*1' to the switch, and change projector to RGB input

    Original Code sent the change to RGB input too quickly.

    Thanks for the catch Joe (again :)).


    --John

    You missed stop screen down in step # 3 before sending 1*1 to the switch.
  • Code above does this:
    1) Screen Down, Projector On
    2) Wait 7 seconds
    3) Stop screen down relay, Send '1*1' to the switch, and change projector to RGB input

    Happier now? :)
Sign In or Register to comment.