25 Step motor delay

Hi all,

I’m fairly new to the arduino stuff but tried to do the biggest part before coming here.

First let me describe my situation:
I’m building a flexible mould for my master thesis, at this point I’m trying to let this mould set itself with data collected from my CAD model. Its not real time (not yet). I’m feeding the distance it should move manually. These 25 motors should run simultaneously but all with a different distance. Once in the right position it should rest there for 5 minutes and go back to the zero position, once there it should wait another 5 minutes before moving to the position given.

I managed to do the script, but once a motor is at its position it moves directly back to the zero position.

My Question:
Where should I put the delay function to maintain the position for 5 minutes before going back to the zero position.

Cheers,
Ari

Flexible_mould2.ino (16.2 KB)

You should avoid delay() I think - the BlinkWithoutDelay example is the place to look at that.

But before doing anything else you need to learn about arrays, you have 25 copies of identical code!!

When you have that many motors use arrays to simplify your program. You can make an array of Adafruit_StepperMotor instances. It is quite impossible to make sense of that code.

I managed to do the script, but once a motor is at its position it moves directly back to the zero position.

Write a short program to do whatever is needed with a single motor. When that works extend it to (say) 4 motors. When that works you should know how to do it for 25.

...R