The problem is you only ever ask the stepper to move to 2000, so it moves there and stays there.
Perhaps you meant move()? This is a relative move, whereas moveTo() is absolute (see AccelStepper.h)
jcallen: The original code structure is correct, run() needs to be called every time round the loop -
please don't answer questions wrongly, it doesn't help anyone. If you are not sure, look it up or
let someone else answer.
MarkT:
The problem is you only ever ask the stepper to move to 2000, so it moves there and stays there.
Perhaps you meant move()? This is a relative move, whereas moveTo() is absolute (see AccelStepper.h)
jcallen: The original code structure is correct, run() needs to be called every time round the loop -
please don't answer questions wrongly, it doesn't help anyone. If you are not sure, look it up or
let someone else answer.
Thanks Mark. The code is for a project my brother is involved in. He was a member on this forum but couldn't remember his login details. Therefore I posted and asked the question.
It now works as it should. As you pointed out it should have been move() not moveTo().