How to achieve continuous rotation on a bipolar stepper motor.

@Precy - you are double posting and wasting time. I have already replied to your question in your other Thread

Here is the other answer - ask the Moderator to lock the other Thread

"its not working" does not provide any useful diagnostic information.

Have you any program that can make the motor work properly?
If not do that first. Don't bother with limit switches or anything else that might complicate things.

If you can make the motor work properly with other code tell us what, exactly, the problem code does.

You don't have any Serial.println() statements to allow you to see the values of the detected switches.

L298s are a poor choice for driving stepper motors. See stepper motor basics.

Post a link to the datasheet for your stepper motor?
Give details of the motor power supply - volts and amps.

My reply would probably have been different if I had known the code came from an experienced programmer and was working for another user. However I think I covered the essential points.

...R