#Include Avrinterrupt1
#Include Avrinterrupt1
#include <avr/interrupt.h>
#include <string.h>
#define AXIS_X 1
#define AXIS_Y 2
#define AXIS_Z 3
void setup()
int i;
pinMode(i, OUTPUT);
DDRC = 0xff;
PORTC = 0x00;
TCCR2A = 0x00;
TCCR2B = 0x00;
TCCR2A |= (0x01 << WGM21); // CTC mode. clear counter on TCNT2 == OCR2A
TCCR2B |= (0x01 << CS22) | (0x01 << CS21); // Start the clock with a 256
prescaler
ISR (TIMER2_COMPA_vect)
int i;
// all layer selects off
PORTC = 0x00;
PORTD = cube[current_layer][i];
if (current_layer < 6)
} else if (current_layer == 6)
digitalWrite(12, HIGH);
} else
digitalWrite(13, HIGH);
current_layer++;
if (current_layer == 8)
current_layer = 0;
}
void loop()
int i, x, y, z;
while (true)
int i;
fill(0x00);
setplane(AXIS_Z, i);
delay_ms(10000);
effect_text(800);
effect_planboing(AXIS_Z, 400);
effect_planboing(AXIS_Y, 400);
effect_planboing(AXIS_X, 400);
effect_blinky2();
effect_random_filler(75, 1);
effect_random_filler(75, 0);
effect_rain(100);
effect_box_wamp(1000);
//box_filled(0, 0, 0, 7, 7, 7);
//
==============================================================================
============
// TEXT Functions
//
==============================================================================
============
char font_data[128][8] = {
//
char string[charNum] = {'A', 'L', 'I', ' ', 'A', 'K', 'S', 'O', 'Y', ' '};
fill(0x00);
for (int ltr = 0; ltr < charNum; ltr++) { // For each letter in string array
int rev = 0;
cube[rev][dist] = bitswap(font_data[string[ltr]][rw]);
rev++;
delay_ms(delayt);
unsigned char bitswap (unsigned char x)//Reverses a byte (so letters aren't
backwards);
{ byte result;
return (result);
/*EKFUNKZ*//*EKFUNKZ*/
fill(0x00);
box_filled(3 - i, 3 - i, 3 - i, 4 + i, 4 + i, 4 + i);
delay_ms(delayt);
fill(0x00);
box_filled(3 - i, 3 - i, 3 - i, 4 + i, 4 + i, 4 + i);
delay_ms(delayt);
}
for (int k = 0; k < 3; k++) {
fill(0x00);
box_walls(3 - i, 3 - i, 3 - i, 4 + i, 4 + i, 4 + i);
delay_ms(delayt);
fill(0x00);
box_walls(3 - i, 3 - i, 3 - i, 4 + i, 4 + i, 4 + i);
delay_ms(delayt);
fill(0x00);
box_wireframe(3 - i, 3 - i, 3 - i, 4 + i, 4 + i, 4 + i);
delay_ms(delayt);
fill(0x00);
box_wireframe(3 - i, 3 - i, 3 - i, 4 + i, 4 + i, 4 + i);
delay_ms(delayt);
int x, y, p;
fill(0x00);
if (invert)
p = (7 - positions[(x * 8) + y]);
} else
p = positions[(x * 8) + y];
if (axis == AXIS_Z)
setvoxel(x, y, p);
if (axis == AXIS_Y)
setvoxel(x, p, y);
if (axis == AXIS_X)
setvoxel(p, y, x);
int i;
int done;
int notdone = 1;
int notdone2 = 1;
int sent = 0;
pos[i] = 0;
while (notdone)
if (mode == 1)
notdone2 = 1;
i = rand() % 64;
if (pos[i] == 0)
sent++;
pos[i] += 1;
notdone2 = 0;
} else if (mode == 2)
pos[sent] += 1;
sent++;
done = 0;
{
if (pos[i] > 0 && pos[i] < 7)
pos[i] += 1;
if (pos[i] == 7)
done++;
if (done == 64)
notdone = 0;
if (origin == 0)
cubepos[i] = pos[i];
} else
cubepos[i] = (7 - pos[i]);
delay_ms(delay);
int i, ii;
int rnd_x;
int rnd_y;
int rnd_num;
for (ii = 0; ii < iterations; ii++)
rnd_num = rand() % 4;
rnd_x = rand() % 8;
rnd_y = rand() % 8;
delay_ms(1000);
shift(AXIS_Z, -1);
int x, y, z;
int loop = 0;
if (state == 1)
fill(0x00);
} else
fill(0xff);
x = rand() % 8;
y = rand() % 8;
z = rand() % 8;
{
altervoxel(x, y, z, state);
delay_ms(delay);
loop++;
void effect_blinky2()
int i, r;
fill(0x00);
i = 750;
while (i > 0)
{ fill(0x00);
delay_ms(i);
fill(0xff);
delay_ms(100);
delay_ms(1000);
i = 750;
while (i > 0)
fill(0x00);
delay_ms(751 - i);
fill(0xff);
delay_ms(100);
int i;
fill(0x00);
setplane(plane, i);
delay_ms(speed);
fill(0x00);
setplane(plane, i);
delay_ms(speed);
if (inrange(x, y, z))
if (inrange(x, y, z))
if (x >= 0 && x < 8 && y >= 0 && y < 8 && z >= 0 && z < 8)
{
return 0x01;
} else
return 0x00;
if (inrange(x, y, z))
return 0x01;
} else
return 0x00;
} else
return 0x00;
if (state == 1)
setvoxel(x, y, z);
} else
clrvoxel(x, y, z);
}
if (inrange(x, y, z))
int tmp;
tmp = ix1;
ix1 = ix2;
ix2 = tmp;
*ox1 = ix1;
*ox2 = ix2;
int i;
cube[z][i] = 0xff;
int i;
if (z >= 0 && z < 8)
cube[z][i] = 0x00;
int z;
int y;
int z;
int y;
{
cube[z][y] &= ~(1 << x);
int z;
cube[z][y] = 0xff;
int z;
cube[z][y] = 0x00;
switch (axis)
case AXIS_X:
setplane_x(i);
break;
case AXIS_Y:
setplane_y(i);
break;
case AXIS_Z:
setplane_z(i);
break;
switch (axis)
case AXIS_X:
clrplane_x(i);
break;
case AXIS_Y:
clrplane_y(i);
break;
case AXIS_Z:
clrplane_z(i);
break;
int z;
int y;
cube[z][y] = pattern;
}
void box_filled(int x1, int y1, int z1, int x2, int y2, int z2)
int iy;
int iz;
void box_walls(int x1, int y1, int z1, int x2, int y2, int z2)
int iy;
int iz;
if (iy == y1 || iy == y2 || iz == z1 || iz == z2)
{
cube[iz][iy] = byteline(x1, x2);
} else
void box_wireframe(int x1, int y1, int z1, int x2, int y2, int z2)
int iy;
int iz;
return flop;
void line(int x1, int y1, int z1, int x2, int y2, int z2)
float xy;
float xz;
unsigned char x, y, z;
int tmp;
tmp = x2; x2 = x1; x1 = tmp;
lasty = y2;
} else
lasty = y1;
lastz = z2;
} else
lastz = z1;
setvoxel(x, y, z);
void delay_ms(uint16_t x)
{
uint8_t y, z;
int i, x , y;
int state;
if (direction == -1)
ii = i;
} else
ii = (7 - i);
if (direction == -1)
iii = ii + 1;
} else
{
iii = ii - 1;
if (axis == AXIS_Z)
if (axis == AXIS_Y)
if (axis == AXIS_X)
altervoxel(ii, y, x, state);
if (direction == -1)
i = 7;
} else
i = 0;
}
if (axis == AXIS_Z)
clrvoxel(x, y, i);
if (axis == AXIS_Y)
clrvoxel(x, i, y);
if (axis == AXIS_X)
clrvoxel(i, y, x);