Switching between 3 power sources using a microcontroller
o-------------+--- &gt;| ---- + ---------- power output
              |            |
3 sources     |            |
o---------+---|--- &gt;| ---- + 
          |   |            |
          |   |            |
o-----+---|---|--- &gt;| -----/
      |   |   |
      |   |   |
      measure here (digital inputs with proper resistors)


beter use Schottky diodes