Hi @Martin-Trojan,
This is just one possible solution, but you can use a custom ST FunctionBlock with this code (use the name "DigitalMemoryMultiplexer" if you do use it):
FUNCTION_BLOCK DigitalMemoryMultiplexer
(*
EXTENDS //base type
IMPLEMENTS //interface type list
*)
VAR
previous_inp_1: BOOL;
previous_inp_2: BOOL;
previous_outp: BOOL;
END_VAR
VAR_INPUT
inp1: BOOL;
inp2: BOOL;
END_VAR
VAR_OUTPUT
outp: BOOL;
END_VAR
INIT
previous_inp_1 := inp1;
previous_inp_2 := inp2;
previous_outp := inp1;
END_INIT
IF inp1 <> previous_inp_1 THEN
outp := inp1;
previous_inp_1 := inp1;
ELSIF inp2 <> previous_inp_2 THEN
outp := inp2;
previous_inp_2 := inp2;
ELSE
outp := previous_outp;
END_IF;
previous_outp := outp;
END_FUNCTION_BLOCK
And connect it like this:
alt text
The DO_2_01 is set as DirectSwitch Trigger and the WEB_LIGHT_BUTTON is tied to a HMI Digital Setter. Whenever you are using DirectSwitch remember to set the Debounce value on the DI sufficiently high for your input device.
Again, there are many other options for doing this, including using two HMI elements on top of each other (Digital Indicator and Digital Setter).
Here is the project file, for reference: https://www.mediafire.com/file/1o8kq9iici2qc8g/ForumProject.7z/file