Why does LED blink below 5hz at max PWM value?

New to electronics, tinkering with pulse width modulation on my led. When I set the frequency at 5hz and give it the max value in analogWrite, it gives me 100% duty cycle as expected. However any frequency below that it will blink and give me a 15.8% duty cycle. What is the reason for this? Why is the led not capable of powering on all the time below this frequency ?

void setup(){
pinMode(4,OUTPUT);
analogWriteFreq(4);
}

void loop(){
analogWrite(4,255);
}

Code is very barebones as you can see, I'm using an esp8266 board however.

PWM is "blinking".

Normally it's faster than the eye can see and the LED appears to dim.

"4" is not a valid frequency. Take that line out completely and use the default value of 1 kHz.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.