Use Main Out as an On/Off Switch with Transmitter

Hi all, I want to use one of the main out pins on my Pixhawk 4 Mini as an on/off switch for a peripheral component such that I can flip a switch on my transmitter and have the peripheral component turn on and off.

How would I do that?