You use limit switches to switch off a motor if it reaches one of its two end positions. Even if you build a microprocessor-based motor controller, you should switch off a motor with hardware by ...