8x8x8 LED Cube With Arduino Mega (+Sound +PS Controller +Game)

Google+ Pinterest LinkedIn Tumblr +

Here is a pattern of the code (results)
you discover the entire (and present) code in final step

void loop()

// ==========================================================================================
// Effect features
// ==========================================================================================

void draw_positions_axis (char axis, unsigned char positions[64], int invert)

// effect_count_up (AZ).
void effect_count_up ()

// effect_count_thru (AZ).
void effect_count_thru ()

void effect_text_up (int delayt, int First, int Last){

const int charNum = 6;
char string[charNum] = ;

fill(0x00);
for (int ltr = First; ltr < Last; ltr++)
}

void effect_text(int delayt, int First, int Last){

const int charNum = 13;
char string[charNum] = ;

fill(0x00);
for (int ltr = First; ltr < Last; ltr++)
}

void effect_boxside_randsend_parallel (char axis, int origin, int delay, int mode)
{
int i;
int completed;
unsigned char cubepos[64];
unsigned char pos[64];
int notdone = 1;
int notdone2 = 1;
int despatched = Zero;

for (i=Zero;i<64;i++)

whereas (notdone)
{
if (mode == 1)
else if (mode == 2)

completed = Zero;
for (i=Zero;i<64;i++)

if (completed == 64)
notdone = Zero;

for (i=Zero;i<64;i++)

delay_ms(delay);
draw_positions_axis(axis,cubepos,Zero);

}

}

void effect_rain (int iterations)

// Set or clear precisely 512 voxels in a random order.
void effect_random_filler (int delay, int state)

// Draw a airplane on one axis and ship it forwards and backwards as soon as.
void effect_planboing (int airplane, int velocity)

void effect_fireworks (int iterations, int n, int delay)

void effect_intro()

void sinelines (int iterations, int delay)

void linespin (int iterations, int delay)

void mirror_ripples(int iterations, int delay)

void effect_axis_updown_randsuspend (char axis, int delay, int sleep, int invert)

void side_ripples(int iterations, int delay)

// blink 1 random voxel, blink 2 random voxels….. blink 20 random voxels
// and again to 1 once more.
void effect_random_sparkle (void)

void quad_ripples(int iterations, int delay)

// ==========================================================================================
// Draw features
// ==========================================================================================

// Set a single voxel to ON (or)
void setvoxel(int x, int y, int z)
= (1 << x);

// Set a single voxel to ON (and)
void clrvoxel(int x, int y, int z)

// This perform validates that we’re drawing contained in the dice.
unsigned char inrange(int x, int y, int z)

// Get the present standing of a voxel
unsigned char getvoxel(int x, int y, int z)

// In some impact we need to simply take bool and write it to a voxel
// this perform calls the apropriate voxel manipulation perform.
void altervoxel(int x, int y, int z, int state)

// Flip the state of a voxel.
// If the voxel is 1, its become a Zero, and vice versa.
void flpvoxel(int x, int y, int z)

// Makes positive x1 is alwas smaller than x2
// This is usefull for features that makes use of for loops,
// to keep away from infinite loops
void argorder(int ix1, int ix2, int *ox1, int *ox2)

// Sets all voxels alongside a X/Y airplane at a given level
// on axis Z
void setplane_z (int z)

// Clears voxels in the identical method as above
void clrplane_z (int z)

void setplane_x (int x)
{
int z;
int y;
if (x>=Zero && x<eight)

}

void clrplane_x (int x)
{
int z;
int y;
if (x>=Zero && x<eight)

}

void setplane_y (int y)

void clrplane_y (int y)

void setplane (char axis, unsigned char i)

void clrplane (char axis, unsigned char i)

// Fill a worth into all 64 byts of the dice buffer
// Mostly used for clearing. fill(0x00)
// or setting all on. fill(0xff)
void fill (unsigned char sample)

// Draw a field with all partitions drawn and all voxels inside set
void box_filled(int x1, int y1, int z1, int x2, int y2, int z2)

// Darw a hole field with facet partitions.
void box_walls(int x1, int y1, int z1, int x2, int y2, int z2)
{
int iy;
int iz;

argorder(x1, x2, &x1, &x2);
argorder(y1, y2, &y1, &y2);
argorder(z1, z2, &z1, &z2);

for (iz=z1;iz<=z2;iz++)

}

// Draw a wireframe field. This solely attracts the corners and edges,
// no partitions.
void box_wireframe(int x1, int y1, int z1, int x2, int y2, int z2)

unsigned char bitswap (unsigned char x)//Reverses a byte (so letters aren’t backwards);

// Returns a byte with a row of 1’s drawn in it.
// byteline(2,5) provides 0b00111100
char byteline (int begin, int finish)

// Flips a byte 180 levels.
// MSB turns into LSB, LSB turns into MSB.
char flipbyte (char byte)
(0b0000Zero100 & (byte >> Three));
flop = (flop & 0b11110111)

// Draw a line between any coordinates in 3d area.
// Uses integer values for enter, so dont count on easy animations.
void line(int x1, int y1, int z1, int x2, int y2, int z2)

// Delay loop.
// This shouldn’t be calibrated to milliseconds,
// however we had allready made to many results utilizing this
// calibration after we figured it could be a good suggestion
// to calibrate it.
void delay_ms(uint16_t x)
{
uint8_t y, z;
for ( ; x > Zero ; x–)
}

void line_3d (int x1, int y1, int z1, int x2, int y2, int z2)

void init_LUT(unsigned char LUT[65])

int totty_sin(unsigned char LUT[65],int sin_of)

int totty_cos(unsigned char LUT[65],int cos_of)

void effect_random_sparkle_flash (int iterations, int voxels, int delay)

// Shift the complete contents of the dice alongside an axis
// This is nice for results the place you need to draw one thing
// on one facet of the dice and have it circulate in the direction of the opposite
// facet. Like rain flowing down the Z axiz.
void shift (char axis, int path)

Read more

Share.

Leave a Reply

%d bloggers like this: