In http://arduino.cc/en/Reference/analogWrite it says,
" The frequency of the PWM signal on most pins is approximately 490 Hz. On the Uno and similar boards, pins 5 and 6 have a frequency of approximately 980 Hz. Pins 3 and 11 on the Leonardo also run at 980 Hz. "
I want now to check that frequency. Simply I typed this command analogWrite(9,127)
, which will generate PWM signal with duty cycle 50%.
Then I used the pulseIn built-in Arduino function (pulseIn descriotion) and typed this command pulseIn(9,HIGH)
to measre the period in which the signal is HIGH. It returns in average 1010 us.
So the period time is 2020 (1010 for the High period and 1010 for the low period) and consequently the PWM frequency from that pin is 495.04 ~ 495Hz.
The same is done with pin number 5. The High period is 506 uS, The full period is 1012 uS, The PWM frequency from that pin is 988.14 Hz ~ 988 Hz.
So, What is the exact PWM frequency ?!
The following pictures is snapshots for the Arduino sketch and the results
The Arduino sketch
When I pressed '1' multiple times
When I pressed '0' multiple times