Need help writing code? You can hire Robots + Big Data to write Arduino software for your project! Click here to get started...Control many servos without delay or interrupts.
See Example Public Methods Release NotesControl many servos at once without delay or interrupts while applying rotation adjustments with PWM/PPM. Quickly calibrate each servo in the constructor() by setting the min and max pulse length (in microseconds), then make real-time adjustments to the rotation with moveToDegrees().
Connect as many servos as the number of digital pins available on your Arduino. This library is very fast and has a small, lightweight code footprint.

#include <RBD_Servo.h>
RBD::Servo servo(2, 1000, 2000); // pin 2, 1ms - 2ms pulse
void setup() {
servo.moveToDegrees(90);
}
void loop() {
servo.update();
}]]>You must continuously call update() inside of loop() in order to use theReal-Time methods tagged below.
RBD::Servo

Pass in an integer for the digital Arduino pin that is connected to the servo movement control wire (orange or yellow).
For the second and third parameters; pass in unsigned longs for the hardware specified microsecond pulse min and max times, which determine the time limits for calculating the length of the orientation pulse (typically between 1000-2000 microseconds, or 1-2 milliseconds).
RBD::Servo servo(2, 1000, 2000); // pin 2, 1ms - 2ms pulse
void setup() {
...
}
Provide an unsigned long to set the amount of time between each orientation pulse. The default is 20ms and is set automatically in the constructor().
void setup() {
servo.setPulseInterval(20); // 20 ms default
}
Provide an integer to set the maximum number of degrees of rotation the servo can handle. The default is 180 degrees and is set automatically in the constructor().
void setup() {
servo.setDegreesOfRotation(180); // default
}

Keep processing and applying servo movements to the motor. This must be called continuously within loop() in order to use moveToDegrees().
void loop() {
servo.update();
}
Provide an integer and the servo will move to the specified position in degrees. This can be called inside of setup() or also at run-time inside of loop().
void setup() {
servo.moveToDegrees(90);
}
void loop() {
servo.update();
}