hmm, i feel somewhat in the dark about your intended goal
in multiple instance similar to yours, i have simply created an array of assigned values to slots. they are binary numbers in decimal representation as well as a state. it will effectively work similar to a debounce, pressing any combination will provide you with a unique sum
int values[8] = {1,2,4,8,16,32,64,128};
int state = 0;
int current = 0;
void loop()
{
// reset current
current = 0;
for(int n = 0; n < 8; n++){current += digitalRead(n) == LOW ? values[n] : 0;}
if(state != current)
{
/*
do something here to execute on value change
*/
// set state to current
state = current;
}
}
my two cents