I had the same issues and found out that I most probably had interference from the powercables onto the signalcables. The case was as follows: I have a CRS 460 robotic arm and I am rebuilding it. I started with 24 Volt DC powersupply to all the servos, one by one starting at joint 6. When I tried joint 3 everything was working accordingly until I applied 68 Volt DC to the servo on joint 3. This servo handles 68 Volts. After that I had the same issues as described in above. It took me a while to figure it out but at the end I connected my home switch to a relais of 24 Volts. The home switch then activates the relais itself and the relais on its turn made the signal high to the arduino.When the relais is not activated, the signal is low. After that, I had no problems at all with my homing switches. It is a workaround but for me it worked.