# Simple Transistor Question

This is a relatively simple, dumb transistor question, but for some reason I can't seem to figure out how I would go about this. I've been Googling transistor flip flops, but haven't quite gotten it the way I want it yet and would like to see what you all think.

I'm trying to save pins on an MCU and I need to alternate between two LEDs to indicate the status of the program. So I thought about doing it like this:

• Each LED is hooked up to a transistor.
• When the pin of the MCU outputs high, one of the LEDs will turn on, the other remain off.
• When that pin of the MCU outputs low, the original LED will turn off, then the other LED turns on.

Essentially it's a flip flop circuit. I'm looking for it to be as simple as possible with the smallest component count\cost.

• This has nothing to do with flip flops: there is no memory aspect (dependency on the past) in your description. You just want the LEDs to react to the current voltage level. Commented Sep 8, 2015 at 15:33

This circuit will do what you want:

simulate this circuit – Schematic created using CircuitLab

If you drive the output high D4 will be on, drive the output low and D3 will be on.

If you need more current than the MCU output can deliver, add a single gate buffer, which can drive up into the tens of mA.

• Beat me to it :D. Also, OP should watch out if LEDs and MCU dont share the same supply voltage, then I guess a couple of transistors would need to be added. Commented Sep 8, 2015 at 15:35
• Oh my God, duh! I should've known this. Many thanks guys. My MCU is at +5V btw. Commented Sep 8, 2015 at 16:41

If your MCU supply voltage is 3.3V you can do it with no components other than a couple of resistors. It is important that the sum of the LED voltages is greater than 3.3V or they will come on even when the MCU doesn't want them to.

If you want one or the other to always be on then that constraint doesn't apply

Set the MCU to one to light D1. Set the MCU to zero to light D2.

Set the MCU to hi-z to turn both off.

If you want both on simultaneously toggle the MCU output at 1kHz or so.

simulate this circuit – Schematic created using CircuitLab