More likely your wiring. From your description of the problem, your pins could be floating.
Read more here https://www.arduino.cc/en/Tutorial/DigitalReadSerial
More likely your wiring. From your description of the problem, your pins could be floating.
Read more here https://www.arduino.cc/en/Tutorial/DigitalReadSerial