I am porting a game of life simulator to ShiftMatrixPWM on an RGB matrix board that the maker of the teensy sent me for free (Thanks again Paul!!!!!!!). I got it working fine,and made it where every pixel is a random color, and then decided to add a fade is so it faded between frames. I have something that should work but in the time that it should be fading, the display is off. Here is the part that I am having trouble with. It is a function that switches to the next frame
void swapGameBoards() {
for (int i = 0; i < maxBrightness; i++){
for (byte row=0; row<NUMROWS; row++) {
for (byte col=0; col<NUMCOLS; col++) {
if (gameBoard[row][col]) {
ShiftMatrixPWM.SetGroupOf3(row, col, (red[row][col]/maxBrightness)*(maxBrightness-i), (green[row][col]/maxBrightness)*(maxBrightness-i), (blue[row][col]/maxBrightness)*(maxBrightness-i));
}
if (newGameBoard[row][col]) {
red[row][col] = random(0, maxBrightness);
green[row][col] = random(0, maxBrightness);
blue[row][col] = random(0, maxBrightness);
ShiftMatrixPWM.SetGroupOf3(row, col, (red[row][col]/maxBrightness)*i, (green[row][col]/maxBrightness)*i, (blue[row][col]/maxBrightness)*i);
}
}
}
delay(10);
}
I have added a serial.println(red[row][col]); before it sends the values out on the 2nd time, like so
but in the serial terminal, its just sending blank lines. I know it is setting the values because on the next frame the colors are different. I really have no idea what is wrong here. Any help is appreciated!
I've not looked closely at it, but detecting equilibrium strikes me as non-trivial. A game in equilibrium could have a high number of non-static elements, particularly if you have a glider gun on your board.
Yea. I was just wondering if there was some easy way to do it since almost all of the youtube videos have some way of resetting after equilibrium is reached. Except the LoL shield example. It just only does a set amount of cycles
I can only guess what ShiftMatrixPWM.SetGroupOf3() does, but you seem to be calling it in a loop to fade down the 'old' game board and then fade up the new one. Problem is, you're doing it in the same loop. Don't you want to have one loop fading down the old game board, and then a separate loop fading up the new one? Otherwise it'll just keep flickering between the old and new game boards.
ematson5897:
PeterH: I was hoping for a smooth transition between the two, but I guess that wont work. I'll deal with this later.
I would certainly be possible to achieve that, but your code doesn't currently do it. At the moment it looks as if you have one code fragment designed to dim the old game and another code designed to bring up the new one, but you're running them in the same loop so they don't work. Split them into separate loops and you should have something that fades the old game out and the new one in
I won't be finishing this for a while. I woke up this morning and my laptop had the bsod. I restarted and my sketch file was mysteriously deleted and so was my internet browser. Too bad there isn't an arduino environment for android tablet -_-
I got my code back! Teensy loader had a hidden copy in its temp files! I ported the detection over to mine. I am going to start on making a menu like yours but with a proccessing interface