Lightweight Servo library for Arduino for 2 Servos at Pin 9 and 10. Needs only timer1, no interrupts or other resources.
GPL-3.0 License
Part of the Arduino library ServoEasing
This library is contained in the Arduino SevoEasing library.
write9()
or write10()
.As simple as this:
#include "LightweightServo.hpp"
void setup() {
// no initialization required for LightweightServo :-)
// or use manual initialization (and compiler macro "DISABLE_SERVO_TIMER_AUTO_INITIALIZE") to save additional 60 bytes program memory
// initLightweightServoPin9();
}
void loop() {
write9(0);
delay(1000);
write9(180);
delay(1000);
}
To customize the library to different requirements, there are some compile options / macros available.
Most macros must be defined in your program before the line #include <LightweightServo.hpp>
to take effect.
Modify them by enabling / disabling them, or change the values if applicable.
Name | Default value | Description |
---|---|---|
DISABLE_SERVO_TIMER_AUTO_INITIALIZE |
disabled | Saves up to 60 bytes flash memory. You must then use the init function initLightweightServoPin9And10() or initLightweightServoPin9_10() manually. |