Im trying to figure out how stop my robot from damaging itself when power is applied to the motors. The servo's go to their neutral position (1500ms) at full speed. I found this post(http://stackoverflow.com/questions/26695670/attach-arduino-servo-without-moving) on how to disable the initial pulse signal to solve this problem using the Servo2Timer2 library. I have not tried this to confirm it b/c I am using the VarSpeedServo library. But I was wondering if it was as easy as commenting out the right the lines of code. I looked over the VarSpeedServo.cpp file but I'm not sure where a change should be made. I've tried various ways from delays to sending pulses before attaching, didn't work. Anyone find a solution for this problem with this library?
With the regular servo library you can use servo.write() before servo.attach() - but that does not solve the problem if you don't know where the servo is physically positioned. To know that you would need an orderly shut-down procedure that "parks" the servos at a specific position prior to power-off.
If the servo is moving between power-on and servo.attach I found that attaching a 4700 ohm resistor between the servo signal and GND connections kept my servo quiet.
I need the speed control VarSpeedServo provides for my robot. I've tried changing the DEFAULT_PULSE_WIDTH variable in the VarSpeedServo.h file, but it did not change the initial position. Neutral (1500ms) position will damage the robot on startup, but I think if I change the default pwm so the bot's joints kinda stretch out first, then retract with slower movement. I think this may have keep it from damaging itself on startup. I will try the 4.7k resistor. Making edits to the library files is just a save and restarting the IDE, correct? Not sure why the change isnt taking affect.
I need the speed control VarSpeedServo provides for my robot. I've tried changing the DEFAULT_PULSE_WIDTH variable in the VarSpeedServo.h file, but it did not change the initial position.
I am not familiar with the VarSpeedServo library but I suspect you would have the same problem with any of the libraries. If you cannot get the servos to "park" at the position at which the library starts there will always be an initial fast movement to the start position. This is nothing to do with the library - it is a feature of servos.
Your library achieves the speed control by making the servo move to a destination in small steps (just like the servo-sweep example in the IDE). The library has no means of knowing where the servo is actually positioned at startup so it sends a pulse width appropriate to some position which is unlikely to be the actual position where the servo last stopped. In that case the logic within the servo tells it to move to the commanded position at full speed. It is only after that that the speed control can have effect.