Help needed with small stepper driver program

Hi,

I am making a small test rig for checking linear acceleration sensors, and for this I would like to use an Arduino controlled stepper motor.

I`ve got the mechanics and electronic components sorted, but my programming skills are rubbish.

What I need: A small piece of programming that, on the push of a button, starts a stepper motor, accelerates to a certain speed, and decelerates back to stop.
At the next push of the button, it should be reversed; the motor accelerates in the opposite direction, to the same speed as before, and then decelerates back to zero before coming to a complete stop on the original position.

There is no need for anything fancy, a simple switch and a four wire stepper driven by a big easy driver (or similar).

Any takers?

Best regards
Asle

The AccelStepper library can do everything you need. It may even have an example that does something close.

Thank you PaulS, I have read all the info I could find on AccelStepper, but unfortunately, beeing able to read is not the same as beeing able to write code :frowning:

My programming skills are about as advanced as your average grandmother :frowning:

What pins is the stepper driver connected to?

What pin is the switch connected to? How is the switch wired?

What rate of acceleration? What speed? For how long?

Lot of unanswered questions, eh?

Yeah, sorry, I might have been a tad to quick in talking myself down...
I am fuly capable of changing values/numbers in an existing program, so as long as there is a value for speed, number of steps, and acceleration, then i can fine tune myself.

As for the physical connections, I have noe specific preference as to where the switch is connected, and the stepper stepper driver could for instance use 2,3,4,5 .

I am sorry for beeing such a noob when it comes to coding, I am definately a HW guy...

I am fuly capable of changing values/numbers in an existing program, so as long as there is a value for speed, number of steps, and acceleration, then i can fine tune myself.

Assuming that the code uses meaningful names, like speed, numSteps, accel, etc. But, if the code uses names like f34, g88, and w22, and direct port manipulation, then it's a lot harder.

PaulS,

I am sure that you are right, but in the few arduino examples I`ve seen the numbers have been more easily identifiable than the (to me) gibberish codes you are listing.

Even after your valiant efforts to assist me, I am still at the same stage as I was 5 days ago, so thank you for the brilliant advice!

(yes, I ment that in the most passive - aggressive way possible)

Best regards, love and kisses, slaps across the face and a boot to the hind quarters,
Yours sincerely
Asle