switches MOSFET as a switch
The transistor shown is a P-channel MOSFET acting as a "high-side switch". More commonly, an N-channel MOSFET low-side switch is used, but what you have will work as long once you add something to the drain such as in this image of P-Channel MOSFET switch from : When the control goes "HI" the MOSFET switch is "OFF. " When the control goes "LO" the