add fountain animation
This commit is contained in:
parent
a9ff478c8e
commit
4e72a85d49
6 changed files with 194 additions and 1 deletions
56
tunnel.ino
Normal file
56
tunnel.ino
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*********************************** TUNNEL ***********************************\
|
||||
|
|
||||
| Modified By: S. Dugre to use asynchronous timer
|
||||
\******************************************************************************/
|
||||
|
||||
|
||||
int color1[] = {R,R,R,R,B,B,B,B};
|
||||
int bright1[] = {2,4,6,8,2,4,6,8};
|
||||
int color2[] = {B,B,B,B,R,R,R,R};
|
||||
int bright2[] = {8,6,4,2,8,6,4,2};
|
||||
int index[] = {0,1,2,3,4,5,6,7};
|
||||
//int animationSpeed =100;
|
||||
|
||||
void tunnel() {
|
||||
|
||||
if (currentState != lastState) {
|
||||
|
||||
lastState = currentState;
|
||||
Serial.print("New State = ");
|
||||
Serial.println(currentState);
|
||||
|
||||
currentTimer = 0;
|
||||
maxTimer = 6250; // 100ms (100,000 us / 16 us)
|
||||
}
|
||||
|
||||
|
||||
if ( timerReset) {
|
||||
drawBoxWalls(color1[index[0]],bright1[index[0]],1,1,0,2,2,0);
|
||||
drawBoxWalls(color2[index[0]],bright2[index[0]],1,1,0,2,2,0);
|
||||
drawBoxWalls(color1[index[1]],bright1[index[1]],1,1,1,2,2,1);
|
||||
drawBoxWalls(color2[index[1]],bright2[index[1]],1,1,1,2,2,1);
|
||||
drawBoxWalls(color1[index[2]],bright1[index[2]],1,1,2,2,2,2);
|
||||
drawBoxWalls(color2[index[2]],bright2[index[2]],1,1,2,2,2,2);
|
||||
drawBoxWalls(color1[index[3]],bright1[index[3]],1,1,3,2,2,3);
|
||||
drawBoxWalls(color2[index[3]],bright2[index[3]],1,1,3,2,2,3);
|
||||
|
||||
drawBoxWalls(color1[index[4]],bright1[index[4]],0,0,3,3,3,3);
|
||||
drawBoxWalls(color2[index[4]],bright2[index[4]],0,0,3,3,3,3);
|
||||
drawBoxWalls(color1[index[5]],bright1[index[5]],0,0,2,3,3,2);
|
||||
drawBoxWalls(color2[index[5]],bright2[index[5]],0,0,2,3,3,2);
|
||||
drawBoxWalls(color1[index[6]],bright1[index[6]],0,0,1,3,3,1);
|
||||
drawBoxWalls(color2[index[6]],bright2[index[6]],0,0,1,3,3,1);
|
||||
drawBoxWalls(color1[index[7]],bright1[index[7]],0,0,0,3,3,0);
|
||||
drawBoxWalls(color2[index[7]],bright2[index[7]],0,0,0,3,3,0);
|
||||
|
||||
|
||||
flushBuffer();
|
||||
clearBuffer();
|
||||
for (int i = 0; i < 8; i++){
|
||||
//index[i] = index[i]==7?0:index[i]+1;
|
||||
index[i] = (index[i]+1)%8;
|
||||
}
|
||||
timerReset = false;
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue