Crestron
SIMPL+
Software
This example assumes that
the camera unit being
controlled continues to move
in a given direction until a
stop command is issued.
Some devices function this
way, but others do not.
DIGITAL_INPUT cam_up, cam_down, cam_left, cam_right;
STRING_OUTPUT camera_command;
PUSH cam_left
{
camera_command = "MOVE LEFT";
}
RELEASE cam_left
{
camera_command = "STOP";
}
CHANGE Events
Change events can be triggered by digital, analog, string, or buffer inputs. Anytime
the corresponding signal changes its value, the change event will be triggered. For
digital signals, this means that the event will trigger on both the rising and falling
edges (push and release). For buffer inputs, this event triggers any time another
character is added to the buffer.
The following example sends a command to a CD player to switch to a different disc
whenever the analog input disc_number changes value.
ANALOG_INPUT disc_number;
STRING_OUTPUT CD_command;
CHANGE disc_number
{
CD_command = "GOTO DISC " + itoa(disc_number);
}
This program uses the
itoa
function to convert the analog value in disc_number into
a string value which can be concatenated onto CD_command. The string
concatenation operator (+) and system functions (i.e.,
itoa
) are discussed in later
sections of the manual and in the latest revision of the SIMPL+ Language Reference
Guide (Doc. 5797).
Compound Events
Sometimes it is desired to have the same (or similar) action occur when any of a
number of events occur. For example, there may be a need to generate a switcher
command string each time any of a group of “output” buttons are pressed.
Compound events can be created in two ways. One way is to provide a list of input
signals separated by commas in the event function declaration. Refer to the following
example.
PUSH button1, button2, button3
{
<statements>
}
A second form of compound event occurs when combining different types of events
into a single function. For example, there may be a need to execute some code when
a button is pushed or the value of an analog signal changes. To accomplish this, stack
the event function declarations, as follows.
Programming Guide – DOC. 5789A
SIMPL+
•
11