Show us how you have the project wired in a schematic.
Unconnected pins are "floating" and will read high and low randomly.http://www.cmiyc.com/tutorials/arduino-pull-ups/Use the internal (or external) pull ups to fix it.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16