Is your circuit glitching? Remember that an input pin won’t necessarily be at 0 volts just because nothing is connected to it. Use a 10k “pulldown” resistor to force an input to 0v.
source: ADAFRUIT DAILY emails
I felt it was a cool tip