LED not fully bright

I need to control 3 leds with 1 button: each time the button is pressed the next led lights up, following the order RED (13), YELLOW (12), GREEN (11). THIS PART IS DONE.
The next part is the one I’m stuck: control the brightness of the current lit up led with a potentiometer, while being able to control which led is lit by pressing the button.

The problem with my code is that the selected led won’t fully light up and will only light up if the potentiometer is all the way on, also, i’m not sure if the potentiometer is really controlling the brightness.

Circuit and code are attached. Thanks!

circuit.png

code.cpp (1.51 KB)

OK, first things first.

You need to go and read the forum instructions so that you can go back and modify your original post (not re-post it) - using the “More → Modify” option below the right hand corner of your post - to mark up your code as such using the “</>” icon in the posting window. Just highlight each section of code (or output if you need to post that) from the IDE and click the icon.

In fact, the IDE itself has a “copy for forum” link to put these markings on a highlighted block for you so you then just paste it here in a posting window. But even before doing that, don’t forget to use the “Auto-Format” (Ctrl-T) option first to make it easy to read. If you do not post it as “code” it could easily be quite garbled and is always more difficult to read due to the font.

It is inappropriate to attach it as a “.ino” file unless it is clearly too long to include in the post proper. People can usually see the mistakes directly and do not want to have to actually load it in their own IDE. And even that would also assume they are using a PC and have the IDE running on that PC.

Also tidy up your blank space. Do use blank lines, but only single blanks between complete functional blocks.