muda:
I have hooked up LED driver to one of PWM pins. It is for night time moon light.
How I cut off light at day ?analogWrite (moon, 0 );
Yes, that is proper form.
or
digitalWrite (moon,LOW );
Interesting if you dig down into the source code for the analogWrite() function, I believe that analogWrite(pin,0); results in simply using a digitalWrite(pin, LOW). As I recall in some early IDE versions the analogWrite(pin,0) showed up a bug where instead of a constant low output there was a single one count duty cycle output and would show up as as very dim light if wired to a high efficiency led. I recall hooking up my oscilloscope to a PWM output set to 0 and still seeing a single high pulse, so something was screwy with the timer counter/resetting/overflow or interrupt or something along those lines. I guess the simple fix was to have the function check for a 0 duty cycle request and just force the output pin LOW.
Lefty
or ...Thanks