xl97,
What you had is looking good.
You could this
for(int led=0; led<8; led++){
to this
for (byte led 1; led != 0; led = led<<1){
so starts with B00000001, and shifts the 1 across until it gets shifted out of the upper end.
I realize you have a matrix, not a cube. THe '7221 controls a matrix.
Each register represents one row (or column, depending how you look at it) of that matrix.
The MAX7221 cycles thru all the registers are quite fast pace (~800 Hz refresh rate per the datasheet).
So you update the array, send it to the MAX7221.
Can send all bytes every time, or just the 1 register that changed.
Just make sure your matrix is wired up like this, even tho you may physically have it spread out to look like a long strip.
