Home AMX User Forum NetLinx Studio

Button State

BUTTON_EVENT[dvPANEL,59]
{
PUSH :
{
ON[dvRELAY,5]

SEND_COMMAND dvPanel,"'^ANI-1,1,2,100'"
}
}

I look around the forum, but I did not find answer. I want to change state of button when I press it, on meabye wneh I have some feed back, but . .. . problem is in SEND COMMAND to Panel. This code up don't work. I have made multistate button .. . but somewhere is problem ?! WHERE ?

Do i need to change feedback of the button in TP Design or something else ?

Comments

  • DHawthorneDHawthorne Posts: 4,584
    I have never used the ANI command. I make my buttons multi-state bargraphs, and use SEND_LEVEL to them for feedback. I don't think you can get a nice smooth animation that way, but it works perfectly if you have a set of discrete states to track.
  • banobano Posts: 174
    VladaPUB wrote:
    BUTTON_EVENT[dvPANEL,59]
    {
    PUSH :
    {
    ON[dvRELAY,5]

    SEND_COMMAND dvPanel,"'^ANI-1,1,2,100'"
    }
    }

    I look around the forum, but I did not find answer. I want to change state of button when I press it, on meabye wneh I have some feed back, but . .. . problem is in SEND COMMAND to Panel. This code up don't work. I have made multistate button .. . but somewhere is problem ?! WHERE ?

    Do i need to change feedback of the button in TP Design or something else ?

    Make sure that the address port and address code for your button are assigned in the programming tab of button properties.

    "'^ANI-<variable text address range>,<start state>,<end state>,<time>'"

    Good Luck!
  • VladaPUBVladaPUB Posts: 139
    DHawthorne wrote:
    I have never used the ANI command. I make my buttons multi-state bargraphs, and use SEND_LEVEL to them for feedback. I don't think you can get a nice smooth animation that way, but it works perfectly if you have a set of discrete states to track.


    Can you post exapmle code ? I want to button remain in that state !
  • I believe you can select any state of a multi-state button using the following:
       "'^ANI-<variable text address range>,<start state>,<end state>,<time>'" 
          Run a button animation. Time is in 1/10 seconds and is optional. 
            0 for state means current state. 
     
            Syntax: 
                    SEND_COMMAND <DEV>,"'^ANI-<vt addr range>,<start state>,
                                                       <end state>,<time>'" 
     
            Variables: 
                    variable text address range = 1 - 4000. 
                    start state = Beginning of button state (0 = current state). 
                    end state = End of button state. 
                    time = In 1/10 second intervals. 
     
            Example: 
                    SEND_COMMAND Panel,"'^ANI-500,1,1,0'" 
                    Sends button with text address 500 to state 1. 
    
            Example: 
                    SEND_COMMAND Panel,"'^ANI-25,2,2,0'" 
                    Sends button with text address 25 to state 2. 
    
     
    
  • VladaPUBVladaPUB Posts: 139
    I asked about SEND_LEVEL command, but never mind, i will try this. Meabye and didn\t explain what I want to do. When I press button and device send feedback, i want to button remain in state, like when I press PLAY on dvd player i want to button PLAY stay on state 2 until device send feedback for STOP.
  • DHawthorneDHawthorne Posts: 4,584
    First, convert the button from multi-channel general to multi-channel bargraph. Assign the level properties, including the maximum aned minimum level values, and number of states (all on the programming tab in button properties). Then set the state in your code with:

    SEND_LEVEL, dvPanel, <level channel>, <device state>

    ... replacing the <> values with the appropriate numbers (no angle brackets).

    Something I like to do with this method is have a state where the button is completely transparent, so I can make it disappear when it cannot be used.
  • VladaPUBVladaPUB Posts: 139
    About a feedback .... it is connected to this quesion .

    I push a button and send a comand to device, i and recive a feedback of device. I want to change a state of button with feedback, something like this :

    dvmatrica = 32002:3:0
    
    data_event[dvMatrix]
    {
    string:
    {
    
    	IF(FIND_STRING (bMatrica,'Out1 In1 All',1))
    	SEND_COMMAND dvPANEL,"'^ANI-10,2,2,0'"
    	SEND_COMMAND dvPANEL,"'^ANI-18,1,1,0'"
    	SEND_COMMAND dvPANEL,"'^ANI-38,1,1,0'"
    	
    	IF(FIND_STRING (bMatrica,'Out1 In2 All',1))
    	SEND_COMMAND dvPANEL,"'^ANI-18,2,2,0'"
    	SEND_COMMAND dvPANEL,"'^ANI-10,1,1,0'"
            SEND_COMMAND dvPANEL,"'^ANI-38,1,1,0'"	
    
            IF(FIND_STRING (bMatrica,'Out1 In3 All',1))
    	SEND_COMMAND dvPANEL,"'^ANI-38,2,2,0'"
    	SEND_COMMAND dvPANEL,"'^ANI-18,1,1,0'"
    	SEND_COMMAND dvPANEL,"'^ANI-10,1,1,0'"
    
    }}
    

    but the button don't remain ih that sate when i push some other button ! I recive a feedback from device, but button don't remain in state that is in this command when i recive some other feedback from same device. How to solve a problem ?
  • DHawthorneDHawthorne Posts: 4,584
    Your conditional statements (IF) only apply to the first line after the condition. The next two lines will fire no matter what. So in that example, every time any string comes in, the second two SEND_COMMANDs after each conditional actually fire no matter what; the conditional doesn't apply to them at all. If you want a group of commands to apply to the conditional, you have to group them with {}'s. What I believe you want your STRING block to look like is this:
    string:
    {
    
    	IF(FIND_STRING (bMatrica,'Out1 In1 All',1)) {
    	SEND_COMMAND dvPANEL,"'^ANI-10,2,2,0'"
    	SEND_COMMAND dvPANEL,"'^ANI-18,1,1,0'"
    	SEND_COMMAND dvPANEL,"'^ANI-38,1,1,0'"}
    	
    	IF(FIND_STRING (bMatrica,'Out1 In2 All',1)) {
    	SEND_COMMAND dvPANEL,"'^ANI-18,2,2,0'"
    	SEND_COMMAND dvPANEL,"'^ANI-10,1,1,0'"
            SEND_COMMAND dvPANEL,"'^ANI-38,1,1,0'"	}
    
            IF(FIND_STRING (bMatrica,'Out1 In3 All',1)) {
    	SEND_COMMAND dvPANEL,"'^ANI-38,2,2,0'"
    	SEND_COMMAND dvPANEL,"'^ANI-18,1,1,0'"
    	SEND_COMMAND dvPANEL,"'^ANI-10,1,1,0'" }
    
    }
    
    Though personally, I prefer the less common style of writing it; I think it's more readable ... comes to the same thing, though:
    string:
    {
    
    	IF(FIND_STRING (bMatrica,'Out1 In1 All',1))
            {
    	    SEND_COMMAND dvPANEL,"'^ANI-10,2,2,0'"
    	    SEND_COMMAND dvPANEL,"'^ANI-18,1,1,0'"
    	    SEND_COMMAND dvPANEL,"'^ANI-38,1,1,0'"
    	}
    	IF(FIND_STRING (bMatrica,'Out1 In2 All',1))
            {
    	    SEND_COMMAND dvPANEL,"'^ANI-18,2,2,0'"
    	    SEND_COMMAND dvPANEL,"'^ANI-10,1,1,0'"
                SEND_COMMAND dvPANEL,"'^ANI-38,1,1,0'"	
             }
    
            IF(FIND_STRING (bMatrica,'Out1 In3 All',1))
            {
    	    SEND_COMMAND dvPANEL,"'^ANI-38,2,2,0'"
    	    SEND_COMMAND dvPANEL,"'^ANI-18,1,1,0'"
    	    SEND_COMMAND dvPANEL,"'^ANI-10,1,1,0'"
             }
    }
    
  • VladaPUBVladaPUB Posts: 139
    Did not solve the problem, doesn't work !! Where the problem can be ?
  • DHawthorneDHawthorne Posts: 4,584
    Open up NetLinx diagnostics and connect to the master in question. In the Device Notifications area, "add" diagnostics for all the messages on that panel, then enable NetLinx notifications. Watch the window as you press buttons, and you will see when the commands go out to the panel .. that should help you track where it is going wrong.
  • Multi-state buttons

    Make absolutely sure that you have set both the channel ID and the Address ID for the buttons you are trying to control.

    I had a similar problem and I could not get the code to work until I noticed that the ^ANI command was referencing the button address code and not the channel code.

    Once I had set the address code correctly, re-loaded the panel and ran my testing and troubleshooting program for this code, everything worked just as I intended it to.

    I'm surprised that the ^ commands were written for the address code instead of the button channel code, but hey, there must have been a reason and we just have to get our brains used to the way the commands are written.

    Brad Odegard
  • TryllTryll Posts: 33
    So, best way to use multi-states?

    Hi all, new member here.

    I'd like to use some multi-state buttons, but I don't want any animation, I want to set every state "by hand". I don't find any clear definition of the send_command syntax in this context.

    In fact, send_command information at all has been pretty scarce. Is there a definitive reference?

    Is this ^ANI command syntax the only way to directly control button states explicitly?

    Thanks for any replies. This looks like an excellent forum.
  • DHawthorneDHawthorne Posts: 4,584
    Tryll wrote:
    Hi all, new member here.

    I'd like to use some multi-state buttons, but I don't want any animation, I want to set every state "by hand". I don't find any clear definition of the send_command syntax in this context.

    In fact, send_command information at all has been pretty scarce. Is there a definitive reference?

    Is this ^ANI command syntax the only way to directly control button states explicitly?

    Thanks for any replies. This looks like an excellent forum.

    Define it as a multi-state bargraph. In your properies, make as many states as you need, and set the level range to your number of states (ie., if you have 5 states, make the minimum level range 1, and the maximum 5). When ytoiu want to change the state of the button, use SEND_COMMAND dvPanel, <level code>, <button state value>.
  • TryllTryll Posts: 33
    Thanks Dave.

    I read some about that earlier in the thread, and it makes sense (I guess).

    Sounds like that is about the cleanest route to really controlling multi-state buttons.

    In a bigger picture sense, *is* there a definitive guide to the various send_commands and its parameters? I've found only scattered bits.
  • DHawthorneDHawthorne Posts: 4,584
    The best I have seen is the programming section of the panel's manual. All the same information is available in Software History by device, but the format is easier to read in the manual ... it just might be superceded by an update, and History should reflect them.
  • TryllTryll Posts: 33
    Oh man, software history! I never use that - I guess I'll need to. I usually figure that the documentation is found in stuff like manuals, and help files.

    Yes. I know. I'm new. ;-)
  • TryllTryll Posts: 33
    Ah, and now I am seeing the info in the panel documentation as well. I had been looking in TPD4 docs, and Netlinx studio docs, since it is programming related and not really hardware related.

    Thanks again.
  • pdabrowskipdabrowski Posts: 184
    yeah, as panels and devices handle commands differently the syntax is always in the manual for the particular device.

    The netlinx and axcess help docs are always to be used in conjunction with the device manuals and software history... it helps keep unnecessary bloat out of the programming manual so it doesn't try to be all things to all devices :)
Sign In or Register to comment.