Hi to all, let's start simple: what should I do if I wanted to play with a couple of AA batteries 1,5v and 1 or 2 supercap cell (2.7v each) to power up a small LED?

I'd like to build a small demo board where, given a programmable device to implement some logic (example like a mid range PIC like 16F690, 16F684) I can set the % or the balance of power flowing to the LED from these 2 sources (or a motor if that suit better as example) - I'd like to balance the power absorption from these two reservoir. Example, if I would attach a trimmer to the PIC, I could set the flow like:

_ 100% from battery
_ 20% from battery, 80% from supercap
_ 100% from supercap
.. and so on

As sidenote, I can stabilize the working DC level to 5v it via a simple switching circuit like max756, so 2AA and 1 supercap cell would be stepped up to 5v independently (or down, depending on power sources voltage, or even a SEPIC..but..). But then I'm missing the building step to implement the power flow control

I feel I really miss some building blocks in electronics, one in particular being the capability to actually ""control"" power flows (double brackets necessary..).

I've posted this simple example, not to be solved by some cheap tricks (diodes, limiting resistors, relays..), rather to really get the point: how do you treat paraller power sources? adding more, at which level do you stabilize, regulate and control power sources?

I was thinking of having just one switching regulator, then I could feed it with the supercap cell and 2AA.. but the problem is still the same, I've only shifted the place where to balance the flow of power.. what's the keypoint?