i think my way of doing if it is just one servo to control
first i would declare a variable Current position
then i would declare a variable called target position
then i would make a function
in that function i would use an idea from blink without delay to increment the current position
if the current position still haven reach target loop again until it does
when it does keep the value of current position and then stop
The fundamental problem with that is that there is no feedback from the servo as to what position it presently is at if moving, from how far it has progressed from the previous position command given, and when it finally reaches the desired new position.
Servos have different speeds and speed can be effected by the amount of mechanical load placed on the servo. So one has to have a pretty well priory worked out 'characterization' for the specific servo under it's real world load condition, to even be able to estimate approximate position attained Vs time elapsed from last position command to new desired position.
It would be nice to have a higher order servo.write function something like:
moveServo(lastPosition, newPosition, step_Size_to_use, total_desired_Elapsed_time_for_completion)
But it would need to be non-blocking with some way to test when the function as completed? Probably really needs to be an addition integrated with the existing servo library.
Lefty
i know that a servo will not return a value, but in this case i would think that the by increment/decrement the value of current position will atleast give the arduino of what is the current position of the servo rite now... i guess you could say that its the same as how we control a stepper motor for a cnc machine... we do not know the actual position/ how much the stepper have rotate. but atleast we have some basic idea of where it should be....
btw retrolefty one thing that would say about servo that is better then a stepper motor is that if a stepper motor get stall, it will loose step and making the position we thick we at and the actual be false.
but for a servo once it receive a command to go to that point, the servo circuitry will make sure it reach that point. so we could actually safely asume that what we think we at and where it is actually is might just be true most of the time.(i say most of the time is due to unforeseen behavior).
and retrolefty if you dont mind hacking your servo to get angular measurement heres 2 link that might be useful
http://forums.trossenrobotics.com/tutorials/how-to-diy-128/get-position-feedback-from-a-standard-hobby-servo-3279/ and
http://www.lynxmotion.net/viewtopic.php?f=2&t=2748