Most probably your inputs are not terminated properly. Use at least mode INPUT_PULLUP, or add external pullup resistors to each input pin.
For better assistance a circuit diagram is needed.
Most probably your inputs are not terminated properly. Use at least mode INPUT_PULLUP, or add external pullup resistors to each input pin.
For better assistance a circuit diagram is needed.