Pre-configured application - generating a controllable test signal using a counter
The test signal is represented by a counter (using a flag) that is incremented every second (using an interval timer).
Adding the flags
Menu Data points → Flags
One flag for the counter and one flag for the running direction of the counter are added for this. Both flags are signed integers and their value persists a restart of the application. The Default value of 1 for flag4 - Counter_Direction defines that the signal (i.e. counter) will be incremented as long as this is not changed via input or MQTT.
Configuration of the counter
Menu Data points → Timer → edit Counter_Timer ()
A timer of the type Interval is added here, which expires (triggers) every second.
Menu Events → edit Counter_Count ()
An event is added here, which triggers an action with each expiry of the timer timer2 - Counter_Timer. The action increments the value of data point flag3 - Counter by the value of data point flag4 - Counter_Direction.
Digital inputs of the router or commands from the ALSO IoT Platform can be used to change the running direction of the counter or reset it (see here for digital inputs and here for MQTT). To increment the counter by 1/s, set flag4 - Counter_Direction to 1; to decrement it by 1/s, set it to -1; to stop counting, set it to 0.