Can any one tell me how to write a code for a Stepper motor to stop after reaching the limit switch?
This is for a sliding window. The Stepper motor will rotate and close or open the window. 2 limit switches are placed on both ends. So when the limit switch is activated, the Stepper motor stops operating.
Have you written any sketches for the Arduino?
What hardware do you have: Arduino type, motor link, motor driver board . . . ?
How is the motor going to be mechanically linked to the window?
You really do need to post a link to the datasheet for your stepper motor - there are hundreds of different models, even when the physical size is the same.
An L298 is not a good choice for driving a stepper motor, and especially one like yours with a low coil resistance. You should use a specialized stepper driver such as a Pololu DRV8825
Well this is just the way to handle the movement to the limit and stop at the limit - I think that's
enough pointer to get you started - once you've a sketch that does something post it? (Unless
you get everything working of course, then you are sorted). You know the details of your motor
and switch and so forth, so try to at least do something with them. If you already have some
code do post it.