What are you trying to engineer around?
I have an array which stores bytes, each one representing a sequence (think of a musical sequence).
For example, "01001000" is a meaningful sequence — both visually and musically, read from left to right.
An array holds 8 of those. Imagine each element of the array representing a different light, led, key, person holding a mallet, whatever.
So the array looks like that:
byte sequence[8] =
{
B00000010,
B10011000,
B00000000,
B00000000,
B00000010,
B00100000,
B00000000,
B00000000
}
Now, when reading the state of eight buttons through the shift register (using software "digitalRead", I don't know how to communicate with SPI yet), I come up with a value which can be 128, 64, 32, depending on which button was pressed. I'd like that value to correspond to an element in the array (i.e. 128 should choose the first element, 64 the second etc).
I read the button values like that because it's then very easy to set flags and check values (the buttons do other stuff except selecting elements from the array).
I hope I'm being clear with this, I'm programming and posting at the same time 