[reference] analogWrite has to be more specific on frequence

Hi, from the reference on analogWrite:

The PWM outputs generated on pins 5 and 6 will have higher-than-expected duty cycles. This is because of interactions with the millis() and delay() functions, which share the same internal timer used to generate those PWM outputs. This will be noticed mostly on low duty-cycle settings (e.g 0 - 10) and may result in a value of 0 not fully turning off the output on pins 5 and 6.

reading this i would expect an error of +-10%, but the truth is that on arduino uno/2009/diecimila etc (don't know about mega and leonardo) the frequency on pin 6 and 6 is DOUBLED, almost 1kHz instead of 500Hz.

This should be pointed out and maybe tell the user this is a feature, not a bug (like, you can have 500Hz PWM on pin x, y, and z, and 1kHz on pin a, b, c)

reading this i would expect an error of +-10%,

The reference talks about duty cycle, not frequency in this respect.

yeah, but because duty cicle is linear to pwm, so the error on pwm is 10%

BTW you are right, the real problem is there:

The frequency of the PWM signal is approximately 490 Hz.

should be changed into

The frequency of the PWM signal is approximately 490 Hz on pin x, y,  z and 980Hz on pin a, b, c.

I agree with lesto. The infos in that page of the Reference aren't accurate. PWM frequency is ~490 Hz on pins 9, 10 (timer 1), 11, and 3 (timer 2), and ~976 Hz on 5 and 6 (timer 0).pins .

leo72:
I agree with lesto. The infos in that page of the Reference aren’t accurate.
PWM frequency is ~490 Hz on pins 5 and 6 (timer 0), and ~976 Hz on pins 9, 10 (timer 1), 11, and 3 (timer 2).

Is exactly the opposite, pins 5-6 @980 Hz, pins 3-9-10-11 @490 Hz :slight_smile:

You’re right, my mistake. I corrected.