limith switch

Hi all,

i want to ask, i have switch limit 2 and step motor limit switch I plug in left and right. when step motor about the right border step motor switch will return again to the left border switch also vice versa. can help me to make the program. thanks

What does it mean to « help you » ? something like write it for you ? (We won’t do that here, there is the Gigs and Collaboration forum where you can pay someone to write code)

I suggest you give it a try and post your code. we will help you if it does not work

void loop()
{
  // Reverse direction if we hit the limit switch in the current direction.
  if (((Direction == 1) && (!digitalRead(ForwardLimitPin))) || (((Direction == -1) && (!digitalRead(BackwardLimitPin)))
  {
    Direction = -Direction;
  }
  motor.step(Direction);
}

Please explain exactly what you would like your code to do and post the code you currently have working.

-- DH