• Could the pin be floating, instead of being pulled up or down? I forget which way the button is wired (ie if it goes to vcc or gnd when pressed) - set the pin to be pulled up or down as appropriate. If it's just an input, it will float when button isn't pressed, and the voltage measured on the pin will depend on ambient electromagnetic fields. That definitely sounds like a floating pin.

About

Avatar for DrAzzy @DrAzzy started