Home AMX User Forum NetLinx Studio
Options

Newie help needed please!

I was wondering if anyone out there could help a Newbie with an efficient way of doing this?

PLH-VS8 if output X is activated

then activate input X,X and output X,X

Any help would e greatly appreciated!

Comments

  • Options
    siebsieb Posts: 9
    Keith, I'll assume you are using the module for the VS8... If you enable the module feedback with the command "FBON", then you can just use a data event to capture the string & look for "Ox". This will get you the event that output "x" changed. I mildly tested this, but it sems to work... dont forget to put "FBON" to the virtual device in the online event of the real device, and the exact string to find as I have below (there is a space after the one).

    data_event [vs]
    {
    string:
    {
    if(find_string(data.text,"'O1 ',$0D",1)) //output to track
    {
    send_command vs,"remove_string(data.text,"'O'",1),'2,3'" //outputs to sync
    }
    }
    }

    Scott
  • Options
    siebsieb Posts: 9
    It just dawned on me the component video application. If this is what you intend, then you need output x input to switch output x+1 to input (what x is on) +1, and soforth for output x+2... Is this correct? Well hopefuly my example will point you in the right direction, you just need to do some more parsing, some math, an ATOI here, an ITOA there... the concept is the same...

    Scott
  • Options
    Scott thanks so much for the reply. Any chance you can help me with a code example for say I am watching output #2 and if that is on activate input #3 and #4 and output #3 and #4? Of course when output #2 goes off I also have to turn off Input #3 and #4 and output #3 and #4. Thanks again for your help!
  • Options
    siebsieb Posts: 9
    try this, I have not checked it, but it looks ok. The component video lines must be sequential, ie input 2,3,4 & output 2,3,4. Be careful of the O's (oh's) and 0's (zero's).
    data_event [vs]					//VS8 module virtual device
    {
        string:
        {
    	stack_var integer input
    	
    	if(find_string(data.text,"'O2 ',$0D",1))	//output to track, green
    	{
    	    input=ATOI(data.text)
    	    if(input=0)
    	    {
    		send_command vs,"'VI0O3,4'"		//if off turn both off
    	    }
    	    else
    	    {
    		send_command vs,"'VI',ITOA(input+1),'O3'"	//outputs to sync, blue
    		send_command vs,"'VI',ITOA(input+2),'O4'"	//outputs to sync, red
    	    }
    	}
        }
    }
    
  • Options
    Scott thanks again. It's nice to have guys out here like you who know what their doing and can help us new guys. Having a small amount of trouble interpreting the code, (newbie you know) but will this code (when sensing output #2 is active) turn on input #3 and #4 and also output #3 and #4. Also will it turn off these inputs and outputs when output #2 is turned off?
  • Options
    siebsieb Posts: 9
    No problem. Yes that is what it should do. The "input" is not coded, so any input that output 2 goes to will be what 3&4 are sent to. The module must have the "FBON" command sent to it to enable feedback. And of course the module set up correctly device-wise. This code looks for the string that has "O2" in the feedback, then it finds the input it is on, then sends output 3&4 to that input. If the input is "0" (off), then it turns 3&4 off. You can copy the code, change the numbers, and use for other "component" devices, just use sequential inputs/outputs in the hookup.

    Scott
  • Options
    Nice! Thanks Scott! I will post after I give it a try!
Sign In or Register to comment.