"General" Button State Change
jabramson
Junior Member
I'm new to programming AMX and I'm wrapping my head around the various commands. One area I need a little assistance is in button states. I know that the preferred method to change the button state (say from off to on) is to make it a multi-state general and then assign it a state through the ^ANI command. I have that up and running.
I'm just curious though, is there a command to do the same with just a general on/off and not a multi-state button?
I was originally trying to figure out how to do it that way and came across the multi-state version which works fine. I'm just wondering, that's all.
I'm just curious though, is there a command to do the same with just a general on/off and not a multi-state button?
I was originally trying to figure out how to do it that way and came across the multi-state version which works fine. I'm just wondering, that's all.
Comments
-
I don't know where you came up with ^ANI as the preferred method, I would say that's the least preferred.I'm new to programming AMX and I'm wrapping my head around the various commands. One area I need a little assistance is in button states. I know that the preferred method to change the button state (say from off to on) is to make it a multi-state general and then assign it a state through the ^ANI command. I have that up and running.
I'm just curious though, is there a command to do the same with just a general on/off and not a multi-state button?
I was originally trying to figure out how to do it that way and came across the multi-state version which works fine. I'm just wondering, that's all.
For general channels set to channel for feedback, feedback or button state control typically occurs in an event and has:ON[dvTP,SomeBtnChannel] ; or OFF[dvTP,SomeBtnChannel] ; or [dvTP,SomeBtnChannel] = nVarState ; or [dvTP,SomeBtnChannel] = (nVarState == SomeValue) ;
Then typically in a define_program or timeline you can do or in an event for that matter:[dvTP,SomeBtnChannel] = nVarState ; //a zero would make the channel OFF and any non zero would make it ON.
Now for multi-states the preffered method IMHO would be to create a multi-state bargraph then you can just send_level to the the button of 0 to what ever to set the desired state for.SEND_LEVEL dvTP,SomeLevelChannel,SomeLevelValue ;
A lot easier and more versatile then using the ^ANI command. -
Button
I agree with Vining.Here is something simple, but you also have to make sure the state is defined or set on TP4. For example the button to change from off to on or/and change color.
***********************************************************)
(* VARIABLE DEFINITIONS GO BELOW *)
(***********************************************************)
INTEGER g_bProj_Main_Power (**BUTTON FEED BACK**)
INTEGER g_bScreen_Down (**BUTTON FEED BACK**)
(***********************************************************)
(* THE EVENTS GOES BELOW *)
(***********************************************************)
BUTTON_EVENT[dvTP,50] // Projector On
{
PUSH:
{
SEND_STRING dvProj,"$02,'PON',$03";
SEND_STRING dvProj,"$02,'OSH',$03";
PROJECTOR_MUTE_STATUS = 1;
IF (PROJECTOR_MUTE_STATUS)
{
SEND_STRING dvProj,"$02,'OSH:0',$03";
}
g_bProj_Main_Power = 1; // here button would turn green and display on
}
}
BUTTON_EVENT[dvTP,51] // Projector Off
{
PUSH:
{
SEND_STRING dvProj,"$02,'POF',$03";
g_bProj_Main_Power = 0; //here the button would turn red and display off
}
}
(***********************************************************)
(* THE ACTUAL PROGRAM GOES BELOW *)
(***********************************************************)
// Display Controls "FEED BACK"
[dvTP,50] = (g_bProj_Main_Power)
[dvTP,51] = (!g_bProj_Main_Power) //the ! means not in order to display off
[dvTP,52] = (!g_bScreen_Down)
[dvTP,53] = (g_bScreen_Down)
Here is a simple code that I got from reading and trial and many errors, good luck -
The advantage to using ANI is that you can configure the time of the transition from one state to another in code.
Paul
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums
