I have 3 buttons that I want to control the power of my amplifiers. I have 2 amplifiers and each turn on lean runs through a relay. "Main Amp" button triggers output 0 and "Sub Amp" button triggers output 1. Now I want a "All Amps" button to trigger both outputs.
I made a button like this:
Code:
<button id="ALL_AMPS" enabled="yes" function="change variable" functionTargetID="amps" vote_opinion="d+1" vote_priority="medium">
<images imagePrimary="content\images\button_images\button_center_down.png" imageSecondary="content\images\button_images\button_center.png" imageDisabled="content\images\button_images\button_center.png" imagePushed="content\images\button_images\button_center_down.png"></images>
<display size="254,74" location="257,367" page="0" z_order="0.9"></display>
<vote_options minimum_delta_vote_time_down="20" ></vote_options>
<text font="verdana" font_size="18"></text>
<text colourPrimaryARGB="255,255,255,255" textPrimary="All Amplifiers"></text>
<text colourSecondaryARGB="255,255,255,255" textSecondary="All Amplifiers"></text>
</button>
Then a Variable:
Code:
<variable name="amps">0</variable>
Then my logic statement:
Code:
<if fire_on="logic" minimum_delta_vote_time="100" id="amps_off">
<boolean_operation type="equal to">
<parameter1>
<variable do="get" name="amps"></variable>
</parameter1>
<parameter2>
<number>1</number>
</parameter2>
</boolean_operation>
<then>
<do function="Trigger Output" functionTargetID="Digital Output 0" vote_opinion="on" vote_priority="medium"></do>
<do function="Trigger Output" functionTargetID="Digital Output 1" vote_opinion="on" vote_priority="medium"></do>
<do function="Change Variable" functionTargetID="amps" vote_opinion="2" vote_priority="medium"></do>
</then>
</if>
<if fire_on="logic" minimum_delta_vote_time="100" id="amps_on">
<boolean_operation type="equal to">
<parameter1>
<variable do="get" name="amps"></variable>
</parameter1>
<parameter2>
<number>3</number>
</parameter2>
</boolean_operation>
<then>
<do function="Trigger Output" functionTargetID="Digital Output 0" vote_opinion="off" vote_priority="medium"></do>
<do function="Trigger Output" functionTargetID="Digital Output 1" vote_opinion="off" vote_priority="medium"></do>
<do function="Change Variable" functionTargetID="amps" vote_opinion="0" vote_priority="medium"></do>
</then>
</if>
Now in theory when I click the button the variable should change to 1 and trigger both outputs 0 and 1, then change the variable to 2. Then when I click the button again it should change the variable to 3 and trigger the outputs 0 and 1 again and reset the variable back to 0.
Now in reality when I click the button it changes the variable to 1 but nothing happens to the outputs. When i click the button again it changes to 2 for a split second then goes back to 1. I can hit the button 100 times and it does the same. If I take out the logic statement the variable goes up by 1 every time I hit the button as it should.
I made the logic in the configurator. The variable "amps" is not used in any other part of my logic other than a text label just so I can monitor it since it wasn't working. Am I doing something wrong in the logic? I remember in pre-mdx software you could link buttons together. Is this still an option also?
Bookmarks