PMW as digital output

Hello, I'm new to this forum and Arduino. I am just a Dummy. And This is my first post here.

I am making a project to light up LEDs in a randomized way.
It works oke.
I know that I can not use A6 and A7 on my Nano.
But is it possible to light up LEDs on the PMW pins.

If you mean the PWM pins, yes it is.

Of course PWM pins. Sorry my mistake.

Just what I wrote, a Dummy.

So, now I know it is possible to use the PWM pins to let LEDs shine.

But what I not know is how I can LEDs shine when connected to the PWM-pins.
So if there is anyone who know how to program a Nano so I can use PWM pins to light-up LEDs connected to this pins, please will you write this down in this topic.

Connect LED to PWM pin, with current limiting resistor.
Connect other end of LED/resistor combo to ground or supply (to taste).
Activate PWM using digitalWrite, or analogWrite (to taste)

Do you want to control the brightness of the LEDs or just turn them on and off ?


So, it is just as the other pins.
But, what number has the PWM pins.
For D03 I write analogWrite(3, 200) for example. So the LED connected to D03 shines bright.
But what numbers do I have to use for the PWM pins?

Assuming you have the LED between the pin and GND, the "200" represents a fraction of roughly 200/255 of full brightness.
In practice, you won't notice any difference between "200" and "255"

Take some time and study this tutorial:


I just have to know what the pins numbers for the PWM pins are.
I have connected LEDs to D3 tot D13. And LEDs are connected to A1 to A5. A6 and A7 don't work for this target.
A0 I use for the Randomize function.
So all the LEDs are on in several ways, reveral times and several brightnes.
And I hope I can use the PWM pins for the same function.

This Nano I use for a model train project. The LEDs are mounted in houses in several cambers.
Like in reality the lights goes on and off in a Randomized way.
In lot of model train projects the houses are light on all at the same time and the hole houses are light on. But that is less reality than my way.

Sorry for the bad English grammatica. But it is understandable I hope.

The PWM-able pins are:
3, 5, 6, 9, 10, 11


I will study it Absolutely.


Thanks all for the information.

I know, for about Arduino I am just a Dummy.

But I'll get by.

Design and code your project now.
I think you will have success with illimunation of model railway.
Have nice day and enjoy coding in C++.