robtillaart, what i'm thinking is much simpler:
I'm trying to code something that will store the value sent to the servo only
at the beginning and ending if the recording, and also measure the time it took to get from "in" to "out".
Then I want in playback mode to make the arduino send values ranging from the first value (In) to the last value (Out), in the course of the exact time it took in the recording.
I thought it could ease up on the memory since I would not store array values between the two points (which are actually focus points in a lens). Makes sense, right?
I though this must be simple to code and somehow I get it all messed up!
the recording part is easy:
start record - store servo position and time
stop record - store servo position and time.
Now playing back is breaking my brains.
I though it should be:
Start play back from 1st servo position and increment value of position by one until you reach the last position - and do that with delays that equal the time the recording took divided by the last position value minus first position value...
Something like this:
for (int i=inPos; i< outPos; i++)
servoTime = ((outTime-inTime)/(outPos - inPos));
And it simply does not work...
What am I (obviously) doing wrong?