Freeing up analogWrite() on pin 10 after servo.detach()

Hi All,

I have a project that uses the Servo and SPI libraries; running on a 328p.
I need to use the Servo library in the void setup() only, and once it is finished, i'm happy to detach the digital servo and then enter the main section of my code.

In the main section, I'd like to use analogWrite() on pin 10, however I have read that the Servo library stops analogWrite() from using Pins 9 and 10.
Even after I issue a servo.detach(), calls to analogWrite() do not appear to be responding to my requests. Does anyone have a work-around for this particular behaviour?
I'd really just like Arduino to forget that I ever called the Servo library in the void setup(), and proceed into main without the lost pins. Does anyone know if this is possible?

Thanks
Matt

Reinitializing timer 1 will get analogWrite working. The code of interest starts about here...
https://github.com/arduino/Arduino/blob/master/hardware/arduino/cores/arduino/wiring.c#L231

Thanks for the reference link - that did the trick :slight_smile:

Matt