updated ansync timer

This commit is contained in:
Sean 2022-04-06 22:38:05 -04:00
parent 62666ebb8c
commit ad9de1e1e4

View file

@ -30,23 +30,30 @@ void rainbow_random() {
cube[x][y][z] = random(24); cube[x][y][z] = random(24);
} }
} }
} }
currentTimer = 0;
maxTimer = 1875; // 30 ms
} }
if ( timerReset) {
for (byte x = 0; x <= 3; x++) { for (byte x = 0; x <= 3; x++) {
for (byte y = 0; y <= 3; y++) { for (byte y = 0; y <= 3; y++) {
for (byte z = 0; z <= 3; z++) { for (byte z = 0; z <= 3; z++) {
byte val = cube[x][y][z]; byte val = cube[x][y][z];
drawLed(red, spectrum[val][0],x,y,z); drawLed(red, spectrum[val][0],x,y,z);
drawLed(green,spectrum[val][1],x,y,z); drawLed(green,spectrum[val][1],x,y,z);
drawLed(blue, spectrum[val][2],x,y,z); drawLed(blue, spectrum[val][2],x,y,z);
if ((x+y+z) % 2 == 0) { cube[x][y][z] = (val+1) % 24;} if ((x+y+z) % 2 == 0) { cube[x][y][z] = (val+1) % 24;}
else { cube[x][y][z] = val == 0 ? 23 : val-1;} else { cube[x][y][z] = val == 0 ? 23 : val-1;}
}
} }
} }
flushBuffer();
clearBuffer();
//delay(30);
currentTimer = 0;
timerReset = false;
} }
flushBuffer();
clearBuffer();
delay(30);
} }