Hi.
I am working with some LED matrices to try to make Game of Life and I am having a problem with my program. Currently I am only using a single matrix.
I have this array which I use to store the current state of the matrix in:
unsigned char buffer[8] = { B00000000,
B00000000,
B00101000,
B00000000,
B00010000,
B00000000,
B00000000,
B00000011
};
Now I want to iterate over each bit in the array from position 0,0 (upper left corner) down to 7,7 (lower right corner) bit by bit.
The reason I want to do this is because for every LED I have to check the neighbooring LEDs if they are on or off.
Does someone know a way to do this? I don't mind changing the structure of how I store the state of the matrix.
Thanks.
EDIT:
The ideal solution I was hoping for is something like this:
for(int i = 0; i < 8; i++) {
for(int y = 0; y < 8; y++){
bit currentBit = buffer[i][y];
// Here would be the logic where I check the bits around the currentBit.
// if(buffer[i-1][y] == 1) then something and so on....
}
}