+ and - motion through sin wave

Hello,
I'm relatively new to arduino. I've used them before in classes but for an important
project I have to control two motors (with an arduino mega). One will have need some
code I've seen before, controlling angle with a sin wave, but the second motor drives a
track. For that motor I need the a different sin wave that will be used to control both speed and
direction. I'm at a bit of a loss where to start on THAT part.

Thanks in advance for any pointers you can give.

Sginther:
I'm at a bit of a loss where to start on THAT part.

Step one would be to describe in plain language what exactly you mean. If you can't describe it in plain English (or whatever your mother tongue) then you have no real hope of ever writing code for it. How is the motion related to a sine wave? Can you show the math of what you mean?

Servo motors are angular motors and you can easily-directly control the angle of a servo motor, but servos don't rotate 360 degrees.

With a stepper motor you may need to calculate the sine, or it's quite-common to use a look-up table (an array), depending on what you're doing. Plus, a stepper needs at least one "home sensor" to find the starting point before you start counting steps. A standard stepper motor has 200 steps per revolution (1.8 degrees per step).

A regular DC motor would need positional feedback (like a rotary encoder, plus a home-sensor). Again, you'd need to calculate the angle or use a table, etc.

Servos come with a motor driver circuit so you just have to provide power and a "signal" from the Arduino.

Steppers and DC motors need a separate driver circuit.

Delta_G:
Step one would be to describe in plain language what exactly you mean. If you can't describe it in plain English (or whatever your mother tongue) then you have no real hope of ever writing code for it. How is the motion related to a sine wave? Can you show the math of what you mean?

What we're working on is an inverted pendulum on a cart, though more restricted. Its an apparatus that performs a fly fishing cast for someone in a wheelchair. One motor is on a track that goes forward and back, and a windshield wiper motor swings the fishing rod. Ultimately the 'cart' moves back and forth on a track driven by a stepper motor, an absolute encoder and a belt, on the card the motor for a windshield whiper swings the rod back and forth between 120 degrees. The eqations of motion for the 'cart' and the rod both fit to a standard sin wave surprisingly well, just out of phase of each other. I suppose rather than putting in a sin wave I could just hard code the timing, but I'm betting that would be the hard way to do this.

If you can describe the motion mathematically then it shouldn't be hard to code it. But if you want help with that you'd obviously have to share the math.

DVDdoug:
Servo motors are angular motors and you can easily-directly control the angle of a servo motor, but servos don't rotate 360 degrees.

With a stepper motor you may need to calculate the sine, or it's quite-common to use a look-up table (an array), depending on what you're doing. Plus, a stepper needs at least one "home sensor" to find the starting point before you start counting steps. A standard stepper motor has 200 steps per revolution (1.8 degrees per step).

A regular DC motor would need positional feedback (like a rotary encoder, plus a home-sensor). Again, you'd need to calculate the angle or use a table, etc.

Servos come with a motor driver circuit so you just have to provide power and a "signal" from the Arduino.

Steppers and DC motors need a separate driver circuit.

Yeah, we have a 'find home' switch that triggers to zero the cart on each pass. I'll look into getting a look-up table for our motor. Thanks. I have to wait for a few parts to come before I can do too much. I'll probably have more questions later.