Here are some previous discussions:
Hope these help. I haven’t tried limit switches, but I remembered there were some previous conversations.