how can i store which button was pressed last time among many...

Store it in the on-chip EEPROM: