Controlling a momentary switch with an on off switch

I am not sure that I understand the question, but if you wish to take an action only when the momentary switch is closed (pressed), use the state change detection method. See also my state change detection for active low inputs tutorial.

As @LarryD asks, Please read the forum guidelines.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in a code block.

2 Likes