I know this is probably a stupid question but I am hobbyist and could not find a solution to this problem.
I have a micro-controller that sends a PWM signal to a transistor that lets current flow through a coil in one direction but I want to be able to change the direction the current flows in every time I send a digital output from another pin on the micro-controller. For that I will have to use another transistor that can let current flow in the other direction.
My problem is that I need a way to switch to which transistor the PWM signal is send to by sending a pulse from a another pin. I am guessing that I will need some sort of digital SPDT switch. Is there anything like this any reference to a component or circuit will help.
A two input H-Bridge made out of 2 NPN inputs, with the motor drive made out of 2 NPN & 2 PNP transistors and 4 diodes.
The specific transistors you use would be rated for your coil, doesn't have to be those specific ones.
If you would still like to use your original approach, it sounds like a SPDT relay would work. Here is a datasheet for one I use often.
There is a control pin which allows you to digitally select between one or the other, but since you are using a microcontroller you will have to drive it with a relay driver circuit like this:
You haven't really given a necessary current but you could also search for "analog multiplexers" that are basically just SPXTs
That's an example.