In this application if trying to run LED directly from UP w/o using
current limiting R you have to be aware of a couple of issues -
1) The UP has a max current / pin spec that you cannot exceed.
You cannot rely on PWM to control that, has to be an R or some
other kind of current limited LED drive, like a current source.
2) The UP has a limit on internal port or buss current limit you
cannot exceed, again only R to limit current supports that. If
you exceed the current you could get internal logic operation
failure.
3) Use of a PWM + Rlimits perfectly acceptable. Note PWM at
100% duty cycle, which is 100% brightness, in this case effectively
out of the circuit, and R establishes the curretn for max brightness.
4) Use of a PWM (with a light sensor) can serve an important function,
control of brightness with ambient light, therefore saving power con-
sumption in a low light environment.
Regards, Dana.