I'm working on a small project. I have 13 leds which need to be controlled individually (turn on or turn off); Since I don't have 13 pwm pins I used a potentiometer to change the brightness.
This works fine for as long as all of the leds stay in the state they are. But once one led turns on or off it affects the brightness of all other leds.
In the picture below you can see how I did connect them. I have the analog pins A0, A1, A2 and A3 occupied by some buttons.
Does anyone know how I can dim the leds in a way where the leds themselves don't affect the brightness?
(note: I am a programmer and not so much of an electrical engineer. Code-related answers are (usually) easy for me to understand. ones about the hardware are not.);