I am trying to have a microcontroller light up a few LED's, all LED's have a forward voltage of about 3V. The issue is that my power supply(which in this mock-up is 9V) will push too much voltage if less than 3 LED's are on at one time, my question then is how can vary the resistance of the circuit or change the circuit so that when the microcontroller changes the number of LED's currently on the circuit doesn't fry?
On the real microcontroller there are extra I/O pins so if those need to be utilized feel free.
simulate this circuit – Schematic created using CircuitLab
Edit: I should also add that I am newer to electronics and may need more explanation on more complex ideas
From the comments made it seems I've made some errors in my assumptions it seems that the diodes would actually be in parallel in the original schematic, this leads me to ask, if I simply changed the power supply to a 3V supply, would the circuit work as I wanted it to? I suspect no, simply because that seems too easy