Greetings. I’m writing some code to control a servo, and because the SoftwareServo documentation said that you have to call ::refresh() at least every 10ms, I made my code diligently call ::refresh() a number of times every 1ms after calling servo.write():
g_servo.write(0);
// ... do some stuff that probably takes < 10ms . . .
// Wait 500ms to make sure servo reaches location
for (int i = 0; i < 50; i++) {
SoftwareServo::refresh();
delay(10);
}
Is this really necessary, as the documentation indicates? Or do you only have to call refresh() once about 20ms after each call to write(), like some sample code seems to do? :-/
Any help, or pointing to informative resources, is greatly appreciated.
Oh, interesting. I googled “Arduino Servo” and got the SoftwareServo library here: http://www.arduino.cc/playground/ComponentLib/Servo , but apparently the ‘standard’ servo lib is the one you linked to which is “Servo.h”, ay. Thanks for the clear-up.
The other library has the methods setMinimumPulse() and setMaximumPulse() for setting up the particular servo’s specifications; does Servo.h have something like that, so that you don’t overshoot the pulse range with write(degrees)? Edit: nevermind, I found it in attach(pin, min, max)