Saturday 11 January 2020

microcontroller - How to control three LEDs with two uC pins using just passive components?


I only have 2 (3-state) pins available on a microcontroller and need to control 3 red LEDs, uC is running on 5V. I can only use passive components in addition.



Answer



To control four LEDs:


schematic


simulate this circuit – Schematic created using CircuitLab


To get both LEDs on a particular pin lit, toggle the pin at a few hundred Hz.


Note that this setup requires that the forward voltage of the LEDs be less than Vcc/2.


Note also that the resistors consume power all of the time, not just when the LEDs are on.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...