Skip to main content
2 of 2
added 4 characters in body; edited title
JRE
  • 73.5k
  • 10
  • 112
  • 194

How does PWM work in the Arduino?

The problem that I have is that I can't understand the working of PWM in Arduino, even though I totally understand what PWM is.

Like the Arduino has a 980hz refresh rate (~1ms clock speed) on two of its PWM pins and 490hz refresh rate (~2ms clock speed) on the others PWM pins.

Then there is Arduino's internal crystal oscillator which works at 16Mhz (~62ns clock speed).

And then I came across this answer:

Why change microcontroller's PWM frequency?

In this the accepted answer gives a little overview on how PWM works.

But I can't seem to understand how does PWM wave fits inside the input window of PWM pins.

As PWM pin take input in every ~1-2ms how are PWM waves formed inside that input window? Can someone explain by showing an example of working like the above answer did.

And does the clock speed of crystal oscillator have anything to do in this process?

*I am totally new to electronics