Change the Output between 0 and 1 on each message that I receive in the input

Thanks @jbudd for your time to reply. your function works for me fine thanks for that. I still want the function 1 to store the last status ether it is "0" or "1" to change it on function 2 when signal 2 sent to it. As the Example shows bellow if Signal 1 pressed the function 1 will start to send "0", So when I press Signal 2 function 2 will have the change that function 1 sent so function 2 will send "1"

each function will get the last update on the other function. to let it as two way switch.