Noise on a Switch

retrolefty:
The problem with your method is that when the switch is not help down there is not a really electrical 0 volts being applied to the pin, but rather a 'floating input' condition. You need to wire a say 5k ohm resistor from the analog input pin and ground, that way when the switch is released the pin will see a ground voltage and give a 0 count return. Try it and see if that does not improve your situation.

Lefty

Thank you so much, this was more or less the kind of answer I was expecting :slight_smile: such as " Put this there and see :slight_smile: "

I tried and things are going much better, even if when I turn on the entire system, ( arduino is used for driving two of these Stepper motor drive - NDC 94 - R.T.A. srl - DC ) there is still some noise, but there are two capacitors big as cow....