Controlling a Button Matrix

schematic.png

No pull-ups! Neither internal nor external. Your inputs are "floating". Try setting the pin mode of the inputs to INPUT_PULLUP.