Arduino PWM pins & Non PWM pins


What is the difference b/w arduino's PWM pins and non PWM pins ? when we use PWM pins and when we use non PWM pins ?

Pwm is just sending pulses at a certain duty cycle. The arduino has internal timers that control PWM, but only certain pins can use it.

For example, a normal pin's output looks like this if put HIGH: 5v_______________________________________


A PWM pin can look like this: 5v __ __ | | | | | | | | | | | | 0v_| |_| | Etc (pretend that that is a square wave)

One use for PWM is simulating an analog output. The arduino's outputs can only output 0 or 5v, but what if, say, you need to make an led turn on at half brightness: if you use PWM, you can make it seem to the human eye that it is dimmer, depending on how long the pin is HIGH relative to how long it is LOW.

One last note: The reason why you'd use a PWM pin to do this rather than a normal pin with software is that on a PWM pin, you can do other things in the code while the pin is outputting PWM.

For a discussion of PWM see:-

A PWM pin can be used like just any other pin. But some pins on the processor can be connected internally to counters, these are the ones that can be used as PWM pins so the hardware generates the pulses without constant software intervention.