I think the answer is yes, but I wanted to ask the question anyway for future common reference. And to check my understanding.
Say I want to power 10 LEDs with PWM with my Mega 2560. I have a bunch of 200 ohm resistors.
I know the Mega and most other Arduinos can safely provide a maximum of 200mA total current. 200mA / 10 is 20mA per LED maximum.
Using my 200 ohm resistors I can calculate how much voltage will supply 20 mA of current:
V = 200 ohms * 20mA V = 4V
So I just need to make sure to analogWrite less than or equal to 4V to each of the ten LEDs and I won't cross the 200mA threshold. That's if PWM was true analog.
However, PWM is not true analog, and if I analogWrite 4V to each pin, they're going to spend most of the time at 5V and some of the time at 0V.
When every pin is at 5V the board has to supply
(5V / 200 ohms) * 10 = 250mA
Which is over the spec, so I am in danger of damaging my board. Right?
So if I want to calculate the maximum current draw of the 10 LEDS being powered simultaneously with PWM, I have to assume that they are all getting 5V regardless of what I analogWrite to them. I do not actually have control over the voltage, I only have control over the resistance.
Thus in order to be safe I need to get some new resistors with resistance:
5V / 20mA = 250 ohms
Is this all correct?