add planarFlop3D animation
This commit is contained in:
parent
86376ae168
commit
c5e12398be
4 changed files with 68 additions and 121 deletions
|
|
@ -48,12 +48,12 @@ void loop() {
|
||||||
trifade();
|
trifade();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RAINBOWCORNER:
|
|
||||||
rainbow_corner();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PLANARFLOP3D:
|
case PLANARFLOP3D:
|
||||||
planarFlop3D();
|
planarFlop3D();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RAINBOWCORNER:
|
||||||
|
rainbow_corner();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
config.h
4
config.h
|
|
@ -9,8 +9,8 @@ typedef enum STATE {
|
||||||
FOUNTAIN,
|
FOUNTAIN,
|
||||||
PLANARSPIN,
|
PLANARSPIN,
|
||||||
TRIFADE,
|
TRIFADE,
|
||||||
RAINBOWCORNER,
|
PLANARFLOP3D,
|
||||||
PLANARFLOP3D
|
RAINBOWCORNER
|
||||||
};
|
};
|
||||||
|
|
||||||
STATE currentState, lastState;
|
STATE currentState, lastState;
|
||||||
|
|
|
||||||
|
|
@ -582,7 +582,7 @@ int currentTimer = 0;
|
||||||
int maxTimer = 6250; // 100ms delay / 16uS interrupt time
|
int maxTimer = 6250; // 100ms delay / 16uS interrupt time
|
||||||
|
|
||||||
int nextState(int state) {
|
int nextState(int state) {
|
||||||
return (state + 1) % 7;
|
return (state + 1) % 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the interrupt function to display the leds (T2 = 8 bit timer)
|
// the interrupt function to display the leds (T2 = 8 bit timer)
|
||||||
|
|
|
||||||
171
planarFlop3D.ino
171
planarFlop3D.ino
|
|
@ -5,7 +5,7 @@
|
||||||
| Modified By: S. Dugre to use asynchronous timer |
|
| Modified By: S. Dugre to use asynchronous timer |
|
||||||
\******************************************************************************/
|
\******************************************************************************/
|
||||||
|
|
||||||
int planarCase;
|
int loop1, loop2, case_pf;
|
||||||
|
|
||||||
void planarFlop3D() {
|
void planarFlop3D() {
|
||||||
|
|
||||||
|
|
@ -16,144 +16,91 @@ void planarFlop3D() {
|
||||||
Serial.println(currentState);
|
Serial.println(currentState);
|
||||||
|
|
||||||
currentTimer = 0;
|
currentTimer = 0;
|
||||||
maxTimer = 3125; // 50 ms
|
maxTimer = 0.1 * 1000 * 1000 / 16; // 100 ms
|
||||||
|
|
||||||
planarCase = 0;
|
loop1 = loop2 = case_pf = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timerReset) {
|
if (timerReset) {
|
||||||
switch (planarCase) {
|
switch (case_pf) {
|
||||||
case 0:
|
case 0:
|
||||||
for (int y = 3; y > 0; y--) {
|
drawLine(color, 0, 3, loop2, 3, 3-loop1, loop2);
|
||||||
for (int z = 0; z < 4; z++) drawLine(color, 0, 3, z, 3, y, z);
|
break;
|
||||||
flushBuffer();
|
|
||||||
clearBuffer();
|
|
||||||
//delay(animationSpeed);
|
|
||||||
planarCase++;
|
|
||||||
currentTimer = 0;
|
|
||||||
timerReset = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
for (int x = 3; x > 0; x--) {
|
drawLine(color, 0, 3, loop2, 3-loop1, 0, loop2);
|
||||||
for (int z = 0; z < 4; z++) drawLine(color, 0, 3, z, x, 0, z);
|
break;
|
||||||
flushBuffer();
|
|
||||||
clearBuffer();
|
|
||||||
//delay(animationSpeed);
|
|
||||||
planarCase++;
|
|
||||||
currentTimer = 0;
|
|
||||||
timerReset = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
for (int x = 0; x < 3; x++) {
|
drawLine(color, 0, loop2, 0, loop1, loop2, 3);
|
||||||
for (int y = 0; y < 4; y++) drawLine(color, 0, y, 0, x, y, 3);
|
break;
|
||||||
flushBuffer();
|
|
||||||
clearBuffer();
|
|
||||||
//delay(animationSpeed);
|
|
||||||
planarCase++;
|
|
||||||
currentTimer = 0;
|
|
||||||
timerReset = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
for (int z = 3; z > 0; z--) {
|
drawLine(color, 0, loop2, 0, 3, loop2, 3-loop1);
|
||||||
for (int y = 0; y < 4; y++) drawLine(color, 0, y, 0, 3, y, z);
|
break;
|
||||||
flushBuffer();
|
|
||||||
clearBuffer();
|
|
||||||
//delay(animationSpeed);
|
|
||||||
planarCase++;
|
|
||||||
currentTimer = 0;
|
|
||||||
timerReset = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
for (int z = 0; z < 3; z++) {
|
drawLine(color, loop2, 0, 0, loop2, 3, loop1);
|
||||||
for (int x = 0; x < 4; x++) drawLine(color, x, 0, 0, x, 3, z);
|
break;
|
||||||
flushBuffer();
|
|
||||||
clearBuffer();
|
|
||||||
//delay(animationSpeed);
|
|
||||||
planarCase++;
|
|
||||||
currentTimer = 0;
|
|
||||||
timerReset = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
for (int y = 3; y > 0; y--) {
|
drawLine(color, loop2, 0, 0, loop2, 3-loop1, 3);
|
||||||
for (int x = 0; x < 4; x++) drawLine(color, x, 0, 0, x, y, 3);
|
break;
|
||||||
flushBuffer();
|
|
||||||
clearBuffer();
|
|
||||||
//delay(animationSpeed);
|
|
||||||
planarCase++;
|
|
||||||
currentTimer = 0;
|
|
||||||
timerReset = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
for (int y = 0; y < 3; y++) {
|
drawLine(color, 3, 0, loop2, 0, loop1, loop2);
|
||||||
for (int z = 0; z < 4; z++) drawLine(color, 3, 0, z, 0, y, z);
|
break;
|
||||||
flushBuffer();
|
|
||||||
clearBuffer();
|
|
||||||
//delay(animationSpeed);
|
|
||||||
planarCase++;
|
|
||||||
currentTimer = 0;
|
|
||||||
timerReset = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
for (int x = 0; x < 3; x++) {
|
drawLine(color, 3, 0, loop2, loop1, 3, loop2);
|
||||||
for (int z = 0; z < 4; z++) drawLine(color, 3, 0, z, x, 3, z);
|
break;
|
||||||
flushBuffer();
|
|
||||||
clearBuffer();
|
|
||||||
//delay(animationSpeed);
|
|
||||||
planarCase++;
|
|
||||||
currentTimer = 0;
|
|
||||||
timerReset = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
for (int x = 3; x > 0; x--) {
|
drawLine(color, 3, loop2, 3, 3-loop1, loop2, 0);
|
||||||
for (int y = 0; y < 4; y++) drawLine(color, 3, y, 3, x, y, 0);
|
break;
|
||||||
flushBuffer();
|
|
||||||
clearBuffer();
|
|
||||||
//delay(animationSpeed);
|
|
||||||
planarCase++;
|
|
||||||
currentTimer = 0;
|
|
||||||
timerReset = false;
|
|
||||||
}
|
|
||||||
case 9:
|
case 9:
|
||||||
for (int z = 0; z < 3; z++) {
|
drawLine(color, 3, loop2, 3, 0, loop2, loop1);
|
||||||
for (int y = 0; y < 4; y++) drawLine(color, 3, y, 3, 0, y, z);
|
break;
|
||||||
flushBuffer();
|
|
||||||
clearBuffer();
|
|
||||||
//delay(animationSpeed);
|
|
||||||
planarCase++;
|
|
||||||
currentTimer = 0;
|
|
||||||
timerReset = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 10:
|
case 10:
|
||||||
for (int z = 3; z > 0; z--) {
|
drawLine(color, loop2, 3, 3, loop2, 0, 3-loop1);
|
||||||
for (int x = 0; x < 4; x++) drawLine(color, x, 3, 3, x, 0, z);
|
break;
|
||||||
flushBuffer();
|
|
||||||
clearBuffer();
|
|
||||||
//delay(animationSpeed);
|
|
||||||
planarCase++;
|
|
||||||
currentTimer = 0;
|
|
||||||
timerReset = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 11:
|
case 11:
|
||||||
for (int y = 0; y < 3; y++) {
|
drawLine(color, loop2, 3, 3, loop2, loop1, 0);
|
||||||
for (int x = 0; x < 4; x++) drawLine(color, x, 3, 3, x, y, 0);
|
break;
|
||||||
flushBuffer();
|
}
|
||||||
clearBuffer();
|
|
||||||
//delay(animationSpeed);
|
switch(loop2){
|
||||||
planarCase = 0;
|
case 0 ... 2:
|
||||||
currentTimer = 0;
|
loop2++;
|
||||||
timerReset = false;
|
break;
|
||||||
|
case 3:
|
||||||
|
loop2 = 0;
|
||||||
|
|
||||||
|
switch(loop1){
|
||||||
|
case 0 ... 1:
|
||||||
|
loop1++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
loop1 = 0;
|
||||||
|
|
||||||
|
switch(case_pf){
|
||||||
|
case 0 ... 10:
|
||||||
|
case_pf++;
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
color = nextColor(color);
|
||||||
|
case_pf = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
color = nextColor(color);
|
flushBuffer();
|
||||||
|
clearBuffer();
|
||||||
|
timerReset = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue