Skip to main content
added 78 characters in body
Source Link
Kevin White
  • 34.2k
  • 1
  • 53
  • 81

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.

schematic

simulate this circuit – Schematic created using CircuitLab

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

schematic

simulate this circuit – Schematic created using CircuitLab

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.

schematic

simulate this circuit – Schematic created using CircuitLab

Source Link
Kevin White
  • 34.2k
  • 1
  • 53
  • 81

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

schematic

simulate this circuit – Schematic created using CircuitLab