How to check if a pin is set from bank?
The problem is here:


//Check if any pin from Port A has been pressed
if (PINA &amp; 0xff){



Since the pullups are enabled, the default state of the pins is high. To detect a "press", they have to be pulled to ground. This changes the test to:

//Check if any pin from Port A has been pressed
if (~PINA) {


And for individual pins:

//Check if PA3 has been pressed
if (!(PINA &amp; _BV(PA3))) {