Microswitches (finicky earth)

Hi I have a microswitch wired to NC D2 with the com going to arduino 5v and the NO going to earth.
I don't have any resistors.. I was wondering why/when they're needed on the data lines particularly..

I've found even the slightest touch and the connection is made.. would people recommend wiring then heat shrinking each of the legs?

Thanks

If I follow your explanation, that's the wrong way wire the switch.

Common to 5v and NO to earth means you're connecting 5v directly to earth when you press the switch. This is a very bad thing that will potentially kill your Arduino.

Here's a nice little tutorial on pull-up resistors.

The diagram there has a button with two connections. Just use the NO and COM connections on your microswitch to get the same behaviour.

If there is no chance of shorts, you do not need heat shrink.
If this is permanent, heat shrink won't hurt.

Wire inputs as seen here:

.

(deleted)

Hi,
A picture of your limit switch and wiring would help.

Arduino D2 to COM
+5 to NO
gnd to NC.

So activating the switch will make D2 go from LOW to HIGH.

Tom.... :slight_smile: