28BYJ-48 stepper motor and ULN2003

Hello Everyone,

i have a question that maybe someone can answer me

for the first time i wanted to working with stepper motor , i spend all weekend understand it and i got it to work with limit switch and its working perfectly

just one problem that i need your help with
they i setup my stepper motor is the limit is from 0-4096 for full 360 circle
but let say i program a button to make is move to position 100 and another one to go to 4000 i want the stepper to take the "short" way to get to the point and not making full circle

i know it is something with either negative (-300) or CW & CCW

any suggestions please help ?
thank you

You need to provide more information. Include the sketch you've written up to this point. Include the model number of the motor and a schematic of your overall circuit.

You should first make sure you have the stepper moving in both directions without issue. Sounds like it is not a big deal, but these 28byj-48's can be a little difficult about moving in both directions. (at least the ones that i have) Try the example sketches from stepper.h and see how you go.

Seems you’re looking for an if/else statement.

if (newPosition - currentPosition < 2048) go forwards,
else, go backwards.

How many forward steps can be calculated from “newPossition - currentPosition”
Or when reversing, “newPosition - 4096 - currentPosition”.

Your stepper has likely about 4076 steps per rotation.