I am working on a turntable based musical instrument.
Essentially a record player that yoyos back and forth
I have sucessfully implemented accelstepper with pots for Max speed, number of steps to travel before reversing, acceleration, and delay at each extreme of travel.
What I have built is great, the effects it produces are exactly what I was looking for.
However, if you imagine each cycle (forward backward) as a bar of music you will appreciate that it would be even better if this bar remained constant in time, but I could change acceleration and Max speed.
In applying this in my current setup I would simply replace the number of steps pot for a cycle time pot.
I realise there are calculation heavy issues with trying to preempt the deceleration so lets assume there is a way to have acceleration but no deceleration.
I also realise most reasons to use a stepper are position based, but as I say this setup works for the slightly hectic sound I'm looking for.
So can anyone help with adding a time patch to accelstepper. I'm OK for a newbie but I'm no programmer. So ideally a little example of driving a motor back and forth with acceleration for x seconds each way.
Its my first post so, sorry if I'm asking too much.
I presume using accelstepper you already define the number of steps and the acceleration / deceleration. Is it not possible to calculate the time from that and then add or subtract steps to get the time you need.
Remember that accelstepper has no means to know what the stepper is actually doing as there is no feedback mechanism. So all of the data is predetermined by you.
I don't know much anything about accelstepper, but presumably it has a command like:
accelstepper.motor1(step); // just guessing
... or something like that which makes it move one step?
If so, then you could have something like:
unsigned long timePeriod = ..... // how ever long you want the effect to last, in millis
startTime= millis();
do {
// whatever command it is that moves one step
} while ((millis()-startTime) < timePeriod);
Doing it this way you won't have the acceleration and deceleration features of accelstepper. You might as well write your own step code and not bother with the library.
...R
JimboZA:
I don't know much anything about accelstepper, but presumably it has a command like:
accelstepper.motor1(step); // just guessing
... or something like that which makes it move one step?
If so, then you could have something like:
unsigned long timePeriod = ..... // how ever long you want the effect to last, in millis
startTime= millis();
do {
// whatever command it is that moves one step
} while ((millis()-startTime) < timePeriod);