Home AMX User Forum NetLinx Studio

Next probelm (RGB)

David_wDavid_w Junior MemberPosts: 23
I am trying to figure out how and where to place the RGB_Select() in the case section of the program. That will allow RGB1 to come up first when coming from Video mode every time. Then after RGB1 is selected when I hit the button again it will cycle through RGB2 and RGB3. I tried to add it various places in the case part of the program and nothing seems to work. Any help would be appericated.


Define Subroute

Define_Function RGB_Select()
{
IF (!RGB_Input)
{
send_string dvPlasma,"'@G',13"
wait 20 send_string dvPlasma,"'%A1002',13"
SEND_STRING 0, "'%A1002',13"
On [RGB_Input]
Off[Video_Input]
}


}

DEFINE PROGRAM

BUTTON_EVENT[dvTP,302]
{
PUSH:
switch(nRGB_Val)
{

case 1:
// set input to RGB2
{
nRGB_VAL = 2
send_string dvPlasma,"'@G',13"
wait 20 send_string dvPlasma,"'%A1000',13"
SEND_STRING 0, "'%A1000',13"
On [RGB_Input]
break
}
case 2:
// set input to RGB3
{
nRGB_VAL = 3
send_string dvPlasma,"'@G',13"
wait 20 send_string dvPlasma,"'%A1001',13"
SEND_STRING 0, "'%A1001',13"
On [RGB_Input]
break
}
case 3:
// set input to RGB1
{
nRGB_VAL = 1
send_string dvPlasma,"'@G',13"
wait 20 send_string dvPlasma,"'%A1002',13"
SEND_STRING 0, "'%A1002',13"
On [RGB_Input]
break
}
default:
{
nRGB_VAL = 1 // so it doesn't get stuck
send_string dvPlasma,"'@G',13"
wait 20 send_string dvPlasma,"'%A1002',13"
SEND_STRING 0, "'%A1002',13"
off [RGB_Input]
break
}
}
}

Comments

  • Chip MoodyChip Moody Junior Member Posts: 727
    Please, please, pretty please use [noparse]
    and
    
    [/noparse] brackets when you're posting code samples - when you've got indentation like that, it's impossible to read otherwise. (Click on the link that says "vB Code" at the bottom of your browser window next time you post a message - there's lots of cool stuff in there)

    Not trying to be rude, but I didn't (attempt to) read your code. :) I'm assuming you have a "video" button somewhere along with your "rgb" button. When you press "rgb" and the system was currently displaying video, you want it to default to rgb 1, correct? Presses after that will step through rgb=2 -> rgb=3 -> rgb=1 -> rgb=2 -> etc., correct?

    How about this:
    BUTTON_EVENT [TP,1]  // Video mode
    {
      PUSH:
      {
        RGB = 3
    
        // do your video mode selection stuff here
      }
    }
    
    BUTTON_EVENT [TP,2]  // RGB mode
    {
      PUSH:
      {
        RGB++    // increment RGB variable
        IF (RGB > 3) RGB = 1    // did we just increment above 3?  Go back to 1 then
    
        SWITCH (RGB)
        {
          case 1:
          {
            // do your stuff for RGB input 1 here
          }
          case 2:
          {
            // do your stuff for RGB input 2 here
          }
          case 3:
          {
            // do your stuff for RGB input 3 here
          }
        }
      }
    }
    

    Make sense? Anytime you go into video mode, the RGB variable gets set to 3 - we can do this since we don't care what RGB input we were on. The next time the rgb button is hit, the variable will be reset to 1. If you're already in rgb mode, the variable gets increased with each button press, then wraps back to 1 if it had been 3.

    - Chip
  • David_wDavid_w Junior Member Posts: 23
    Thanks Chip

    Hey it to late for my recent code post but I do that from now on. Thank you for your help.
Sign In or Register to comment.