how to save pwm pulses given to the motor

hello, i m using arduino to run servo motor and i want to save the pulses given to the motor for future reference and to use the same pulses again. so please guide me in detail regarding the question above. Thanks.

First off you do not use the PWM of the Arduino to drive a servo. You use the servo library. Second what you send to the servo is a pulse of a specific width. As your code sends it then simply store what you send in another variable or array.

Now that answers your question but I suspect this in not what you want to do. How about telling us what that is specifically.

want to use the input pulses as a recipe. storing different values for different recipes. and recalling those values when recipe is selected.

Sorry it doesn't make any sense.

Do you know how to program a servo? There is nothing to record.

Sorry it doesn't make any sense.

Do you know how to program a servo? There is nothing to record.

He means:

He want's to use the servo for a specific task like moving right and left and record/store that values in a variable or sd card so in the future to take that stored values and use them automatically.

If you still didn't understand just look this video i hope it make sense now :D

https://www.youtube.com/watch?v=bLnAJ-mSElE

D.60

I'd move the servos into the desired position, then press a button to measure and store the servo signals. Repeat until all positions have been recorded. On playback, use a reasonable delay for moving from one position to the next one.

Or measure the signals at regular intervals, and store them until a stop button is pressed. Play back at the same rate.

I'd move the servos into the desired position, then press a button to measure and store the servo signals. Repeat until all positions have been recorded. On playback, use a reasonable delay for moving from one position to the next one.

Or measure the signals at regular intervals, and store them until a stop button is pressed. Play back at the same rate.

So you just commented what the video I posted is doing :D

The OP is asking how exactly to do that, code and in which possible way to record that values and process them after that as input values.

I couldn't watch the video yesterday, download stopped after a few seconds and never resumed. Today I could see it without such problems.

There is no "exact" way to do all that. Reading and writing arrays is a basic task, accessing a SD card is a matter of proper use of the library. The record layout for the steps depends on the intended functionality, number of servos etc. I've presented possible solutions, now waiting for feedback.

I did something similar years ago - in a completely different technology...

When you 'learn' each servo movement, record a timestamp as well (millis) as an offset from the first/previous movement.

Then to replay a sequence, simply step through the array of learned positions - at the intervals specified by the timestamps, and voila... all done.

Then to replay a sequence, simply step through the array of learned positions - at the intervals specified by the timestamps, and voila... all done.

I wanted to try same as in the video but didn't had the time to do a small project like that, maybe in the future I will try

nabil772: want to use the input pulses as a recipe. storing different values for different recipes. and recalling those values when recipe is selected.

You don't store the pulses for the recipe. You just store the servo positions. When you have a position the Arduino can easily generate the appropriate pulses to make the servo move to that position.

...R

When multiple servos act together, as demonstrated in the video, their movement may deserve synchronization. Else a fast pan servo may hit the ramp, while the tilt servo still moves the load up. You can find out yourself whether a more sophisticated steering model is required, once you've finished the construction of your project. Don't worry now, the code can be improved at any later time.

Good point The technique of in-betweening is quite easy to implement. Think dV/dT

If multiple timelines are involved, divide each interval by the number of steps. For each 'step' increment each channel by their specific step value (which could be positive or negative!)