Actions are the core of CTC's control functions. With them, you define both which buttons and controls are displayed where in the CTC app and what should happen automatically.
Note: If you have connected a product as described in the previous chapter, suitable actions will already have been created. However, these may still need to be fully configured, e.g. an IR beacon already has a trigger for linking to a signal, but the signal must still be selected as the "trigger".
There are the following types of actions:
- Function: Appears as buttons in the CTC app, e.g. to control turnouts and signals or activate loco functions.
- Value control: Appears as plus/minus buttons and sliders in the CTC app to adjust a numerical value.
- Trigger: Allows the CTC app or CTC module to react to changes in any other action, e.g. a signal can turn red after a turnout has been set.
- Sensor: This action is connected to a sensor in the CTC module, e.g. a contact track. The sensor's value is displayed in the CTC app and can (like all actions) initiate a trigger.
- Timer: This action is used to perform tasks regularly or after a certain time, e.g. our IR beacon is a timer that cyclically sends an infrared message.
Each action has a state in the form of a letter or number. This state can be used in the trigger to react only to specific state changes.
When you add a product, suitable actions are also created immediately.
Note: Actions that cannot be assigned to a CTC module are edited via the "Modify automation" button. These include, for example, the triggers of an NFC beacon.
Function
A function is a collection of related buttons or switches. Each of these buttons has an associated script (see Chapter 4.5 - Edit script ) that is executed when the button is pressed.
For example, a turnout has two buttons, one for "straight" and one for "divert". When the button is pressed, the corresponding CTC module executes the associated script. In the case of our turnout, for example, a 250ms pulse is sent to the turnout drive to set the turnout.
The function always reports the last button called as its state. This then provides the basis for triggering subsequent actions using a trigger.
Unlike most model railway control systems, our function can also consist of more than two buttons.
Value control
A value control can adjust a numerical value, e.g. set a servo to a specific angle. The most obvious value control is the speed control of a locomotive.
The state of a value control is the last set value.
Trigger
A trigger is very similar to a function, but is not triggered by a button, but by a state change in another action.
Like the function, the trigger consists of several scripts (see Chapter 4.5 - Edit script ), which are executed depending on the new state of the triggering action.
If the trigger is stored on the same CTC module as the triggering action, the CTC module will trigger it directly. Otherwise, the CTC app takes care of triggering the trigger.
Timer
A timer can be executed regularly (cyclically) or just once.
After its time has elapsed, the timer executes its script (see Chapter 4.5 - Edit script ). For example, you can control motorised turnouts by switching on the motor in the script of a function and calling a timer that then switches off the motor again after a specified time (e.g. 5 seconds).
The IR transmitter is a special case: it has no script and (hard-coded) regularly sends a message via infrared. The message is composed of the name of the IR transmitter and the predefined parameters dist, cmd and cmdDist. We recommend adding the "IR beacon" product from the "universal-sensors.xml" product catalogue.
Sensor
A sensor is linked to an input pin of the CTC module (currently only the Multi-I/O board). The sensor then forwards the state of the input pin as its state.
A trigger can now be used to start a follow-up action.