How to use a transistor as a switch