Faster Servos, Smoother Projects
A post to introduce a new library RCArduinoFastLib.
The library supports upto 20 servos on an Arduino in two banks of 10.
The two banks can have an independent refresh rate allowing you to run ESCs at high frequency on one bank and Servos at 50Hz on the other - or everything at the same frequency, whatever you choose.
The library includes two main optimisations over the standard servo library-
1) It does not reset timer1 so you can safely use timer1 for timing tasks in your project such as reading RC Pulse widths. This might not sound like much but its many times faster than having to call millis which means less time inside ISRs and less glitches.
2) The library avoids using digitalWrite which give another speed boost.
So if you want more servos, adjustable refresh rates, faster code or smoother RC Projects read on -
The library usage is similar to the standard library
// attach servo objects, these will generate the correct
// the refresh rate can be set through independent control of the framespace -
// Set the pulse width for a servo -
I will post a follow up with some usage examples on the RCArduino blog