If you have now wired the switches so that they are now connected between ground and the corresponding arduino pins, you should have this:

. . .

pinMode(button_a, INPUT_PULLUP); // If button pressed, digitalRead() == LOW otherwise it is HIGH.

pinMode(button_b, INPUT_PULLUP); // If button pressed, digitalRead() == LOW otherwise it is HIGH.

// no digitalWrite() statements are needed.

. . .

. . .

// if button_a is pressed, store it

if (stateA == LOW) {

stored_state [last_x][last_y] = true ;

}

// if button_b is pressed, delete it

if (stateB == LOW) {

stored_state [last_x][last_y] = false ;

}

. . .

. . .

I guess this code should be as follows because storedState[ ] [ ] uses indexes 0 to 15 so should correct the problem you have described where only the first matrix appears to be used for store/recall :

if ( (last_x != x_translate) || (last_y != y_translate) )

{

// the position has moved so we need to restore previous state

if ( last_x < 8 && last_y < 8 ) lc.setLed(0, last_x, last_y, stored_state [last_x][last_y] );

if ( last_x >= 8 && last_y < 8 ) lc.setLed(1, last_x - 8, last_y, stored_state [last_x][last_y] );

if ( last_x < 8 && last_y >= 8 ) lc.setLed(2, last_x, last_y - 8, stored_state [last_x][last_y] );

if ( last_x >= 8 && last_y >= 8 ) lc.setLed(3, last_x - 8, last_y - 8, stored_state [last_x][last_y] );

}