how to get pwm back from frequencytimer2

I am using Frequencytimer2 and it uses the pwm from pins 11 and 3.

I also have a servo hooked up and the servo library uses pwm 9 and 10.

This leaves me short a pwm. Is there anyway to get one of them back from frequency timer??

No there isn't. The hardware timer needed for the PWMs is used by the frequencytimer2 library.

You can manually do the PWM in software, maybe even using frequencytimer2 to help. Or you can use a second chip to give you more PWM outputs, even programming a second arduino as a PWM slave over spi.

I actually already have a second arduino as a slave but since it is using a Wave Shield almost all the pwms are used up on that too! (only two left).

One option for me to get a pwm back is to use an older servo library instead of the new one with 012 that uses pwm 9 and 10.

The older library will let you use any pin (I guess it does pwm in software).

thanks, Danjel

Hi Danjel,

Yes, if you are using timers 1 and 2 for PWM then you will need to refresh the servos from your sketch. The servo library in the playground that works that way is here: http://www.arduino.cc/playground/ComponentLib/Servo

Your sketch would need to call the refresh method at least 20 times per second, and around 50 times per second to get the maximum performance from the servos.

But all the timers are then free for other purposes.

Have fun!