Grumpy_Mike:
No because the servo has to stop to change direction and that will screw the waveform with a pause at direction reversal.But why not just have a normal motor and just let physics do its thing?
yes, the changing of direction will have to occur at the peaks. Are you saying that a servo cannot change direction fast enough to give a reasonable approximation of a waveform?
The reason I am using a servo is that it is a closed loop system so I am sure It is following the waveform I want it to.
DVDdoug:
Assuming your mechanism can do what you want with 180 degree rotation...Is your program working to the point where you can position the motor where you want it? If so, it's just a matter of synchronizing the position with time...
The Arduino can calculate sine and cosine, but it's common to use a table. All you need is a 0-90 degree table and you can reverse & invert to get the remaining 270 degrees.
I guess the trick is to realize you're in the digital domain and everything (time and position) is quantized. That means you'll be moving the servo in steps. They can be very-small steps, but you have to program discrete positions at a specific time.
I have the servo set up so that I can control the distance yes, as I know the microseconds per degree of turning and can calculate the linear distance moved with trigonometry.
Okay, so I can use a table, the best way to this is to have it as an array in the code with the data points from the table?
Thanks again guys!