Inconsistent reed switch status

Hi everyone, I made a software to control my garage gate using a nodeMCU and and reed switch with an extension cord of around 4 meters. When reed switch is in closed state, the values on the bofe MCU are floating between high and low. I am using a 10K resistor, do you guys think is because of that? When using a wire to switch state, everything works normally..

vaz83: Hi everyone, I made a software to control my garage gate using a nodeMCU and and reed switch with an extension cord of around 4 meters. When reed switch is in closed state, the values on the bofe MCU are floating between high and low. I am using a 10K resistor, do you guys think is because of that? When using a wire to switch state, everything works normally..

A simple wiring diagram is worth a page of description. And would probably answer your question.

Paul

You could try a lower value, 1K.

As mentioned: Show us a good schematic of your circuit. Show us a good image of your wiring. Give links to components. Posting images: https://forum.arduino.cc/index.php?topic=519037.0

Please verify the NodeMCU inputs are floating when the reed switch is closed. If this is the case I suspect you have a bad reed switch or bad connection to the reed switch.

In any case, the pullup resistor (now 10K) should be lowered to the above recommended 1K or perhaps 2K would be okay. (didn't want to say OK and confuse things :) )