I would be glad to be adviced on some programming questions please :
I would try to move a stepper motor to a defined position.
for example :
if analog voltage is "x" move to step 800
if analog voltage is "y" move to step 200
I understand that I need to home the motor with a limit switch first but cannot figure out the code to move according the previous position to the next one ...
Hope my english will be understandable enough to go further !
Thanks
Philippe
if you use the standard Stepper library, after you "homed" your system you need to remember where you are and issue the request to move based on this.
assume you have 3 postions: home, pos800, pos200
if you are home and voltage is x, then step +800 and remember your are at pos800
if you are home and voltage is y, then step +200 and remember you are at pos200
if you are at pos800 and voltage is x, do nothing
if you are at pos800 and voltage is y, then step -600 and remember you are at pos200
if you are at pos200 and voltage is x, then step +600 and remember your are at pos800
if you are at pos200 and voltage is y, then do nothing
if you are using AccelStepper then after you homed you can register this position being 0 with setCurrentPosition() and the moveTo() function call takes an absolute position so you don't really need to remember where you are. just do moveTo(800) or moveTo(200) based on the voltage