SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By guster11
#189798
Hey guys, I have been trying to implement Conway's game of life and have it output on my 32x32 matrix. However, I seem to be running into memory issues which make no sense, since I still have a minimum of 35% of my SRAM available even when implementing a full 32 by 32 byte array. What I want to do is use a 32x32 matrix of bytes to store either 1 or 0, representing whether the cell is alive or not.

The only way I can get the board to output anything is if I keep the dimmensions of board to 5, anything greater and it doesn't print anything. It sure acts like its an issue with running out of memory, but at the same time the compiler says I have enough SRAM. In the case of a 6 by 6 matrix, I'm only using 16% of the SRAM. Is there a library function I missed that allow me to get the color of a cell? If that was the case I could do away with the array all together, but I don't believe the color of each LED is stored anywhere.

I'm thinking I might need to use another board to drive this project as the Arduino appears to be a dead end, but any help or ideas would be greatly appreciated!
Code: Select all
byte board[4][4];

void setup() {
  matrix.begin();
  matrix.drawPixel(16, 16, matrix.Color333(0, 0, 5));
  Serial.begin(9600);
  initBoard();
  board[3][0] = 1;
  print();
  
}

void loop() {
  // put your main code here, to run repeatedly:

}

void print(){
  int i,j;
  for(i = 0; i < 4; i++){
    for(j = 0; j < 4; j++){
      if(board[i][j] == 1){
        matrix.drawPixel(i, j, matrix.Color333(7, 2, 4));
        delay(200);
      }
    }
  }
}

void initBoard(){
  int i,j;
  for(i = 0; i < 4; i++){
    for(j = 0; j < 4; j++){
      board[i][j] = 0;
    }
  }
  
}