Arduino and PWM

one question,
why the arduino function analogWrite only work in 6 pins?

I needed to use 7 PWM ports, so I wrote new function so that I was able to use up to 14 PWM pins.

Thanks

Want to tell us anything about the function? How does it work? What timers does it use? What frequency is the duty cycle change?

I used a part of the code found on arduino.cc website.

To make the LED fade, I used the function delayMicroseconds

worked well

    for(i=1;i<=1000;i++){
      digitalWrite(j, HIGH);
      delayMicroseconds(i); 
        digitalWrite(j, LOW);
        delayMicroseconds(1000 - i);
    }

And the processor load vs. using the PWM pins?
Why did you stop at 14?
What about the analogue pins?

With the code snippet above, for 14 pins, you're looking at a refresh rate of around 70Hz, which will produce noticeable flicker on an LED.

The hardware pins operate at around 490Hz.

ah, that's the difference then
but i cant see it flickering :slight_smile:

For all the pins PWMed see:-
http://www.arduino.cc/playground/Main/PWMallPins