Limit Switch Help

Hi all,

I’m currently trying to get two limit switches to work with my XY stepper motor design. I have the Arduino’s 5v running to the breadboard, and then the 5v splits to go to two limit switches’ normally-closed. The Arduino’s ground goes to the ‘-’ on the breadboard, and then splits to go through two 1k resistors that meet up with two Arduino pins and go to the COM on each switch. When I run my program, however, and read the input from each switch independently, it doesn’t matter which switch is hit - they both go HIGH when either is pressed.

How do I separate the two so that when I get a digitalRead of either switch, they independently go HIGH, not both? A sketch of my diagram is included. Thanks!

Hey guys never mind I was able to figure out my issue - simple wiring problem. I originally had the two switches sharing a resistor but I gave them each their own and it works perfectly!

What resistance would you recommend that I put on the limit switch setup to avoid EMI from my stepper motors? I saw somewhere that 250-1K Ohms is a good range. Thanks!