Good nite i got a question about this code i wanna put some effect this is original code to start that cube..
<
/***************************************************************************************
* Name : LED CUBE 8x8x8 74HC595
* By :
****************************************************************************************/
#include <TimerOne.h>
#include <string.h>
#define AXIS_X 1
#define AXIS_Y 2
#define AXIS_Z 3
//--- Pin connected to ST_CP of 74HC595
//--- Gelbe Leitung RCK
int latchPin = 10;
//--- Pin connected to SH_CP of 74HC595
//--- Schwarze Leitung SCK
int clockPin = 13;
//--- Pin connected to DS of 74HC595
//--- Lila Leitung SI
int dataPin = 11;
//--- Used for faster latching
int latchPinPORTB = latchPin - 8;
//holds value for all the pins, [x][y][z]
byte cube[8][8];
//Counts through the layers
int current_layer = 0;
//--- This process is run by the timer and does the PWM control
void iProcess(){
//last layer store
int oldLayerBit = current_layer + 2;
//increment layer count
current_layer++;
if(current_layer >= 8){
current_layer = 0;
}
//--- Run through all the shift register values and send them (last one first)
// latching in the process
latchOff();
for (int i = 0 ; i < 8 ; i++){
spi_transfer(cube[current_layer][i]);
}
//Hide the old layer
digitalWrite(oldLayerBit, LOW);
//New data on the pins
latchOn();
//new layer high
digitalWrite(current_layer + 2, HIGH);
}
//--- Direct port access latching
void latchOn(){
bitSet(PORTB,latchPinPORTB);
}
void latchOff(){
bitClear(PORTB,latchPinPORTB);
}
//--- Used to setup SPI based on current pin setup
// this is called in the setup routine;
void setupSPI(){
byte clr;
SPCR |= ( (1<<SPE) | (1<<MSTR) ); // enable SPI as master
SPCR &= ~( (1<<SPR1) | (1<<SPR0) ); // clear prescaler bits
clr=SPSR; // clear SPI status reg
clr=SPDR; // clear SPI data reg
SPSR |= (1<<SPI2X); // set prescaler bits
delay(10);
}
//--- The really fast SPI version of shiftOut
byte spi_transfer(byte data)
{
SPDR = data; // Start the transmission
loop_until_bit_is_set(SPSR, SPIF);
return SPDR; // return the received byte, we don't need that
}
void setup() {
Serial.begin(9600);
//layer pins
for(int i = 2; i < 10; i++)
{
pinMode(i, OUTPUT);
}
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
digitalWrite(latchPin,LOW);
digitalWrite(dataPin,LOW);
digitalWrite(clockPin,LOW);
//--- Setup to run SPI
setupSPI();
//--- Activate the PWM timer
Timer1.initialize(100); // Timer for updating pwm pins
Timer1.attachInterrupt(iProcess);
}
void loop(){
int i,x,y,z;
while (true)
{
//effect_random_filler(75,1);
// effect_random_filler(75,0);
// effect_planboing(AXIS_Z, 700);
//effect_planboing(AXIS_Y, 700);
// effect_planboing(AXIS_X, 700);
//effect_text(1000);
// effect_random_sparkle();
//effect_random_sparkle_flash (2, 50 ,500);
//sineWave3d();
space(100);
space(100);
// effect_intro();
//effect_blinky2();
// effect_wormsqueeze (2, AXIS_Z, -1, 100, 1000);
// sinelines(4000,10);
// side_ripples (300, 500);
// mirror_ripples(600,400);
// quad_ripples (600,300);
// linespin(1500,10);
// fireworks(10,20,500); //10,30,500
// effect_rand_patharound(200,500);
// effect_box_wamp(1000);
// effect_rain(100);
//effect_boxside_randsend_parallel (AXIS_X, 0, 200, 1);
//effect_boxside_randsend_parallel (AXIS_X, 1, 200, 1);
//effect_boxside_randsend_parallel (AXIS_Y, 0, 300, 1);
//effect_boxside_randsend_parallel (AXIS_Y, 1, 300, 1);
//effect_boxside_randsend_parallel (AXIS_Z, 0, 600, 1);
//effect_boxside_randsend_parallel (AXIS_Z, 1, 600, 1);
//effect_axis_updown_randsuspend(AXIS_Z, 550,5000,0);
//effect_axis_updown_randsuspend(AXIS_Z, 550,5000,1);
//effect_axis_updown_randsuspend(AXIS_Z, 550,5000,0);
//effect_axis_updown_randsuspend(AXIS_Z, 550,5000,1);
//effect_axis_updown_randsuspend(AXIS_X, 550,5000,0);
//effect_axis_updown_randsuspend(AXIS_X, 550,5000,1);
//effect_axis_updown_randsuspend(AXIS_Y, 550,5000,0);
//effect_axis_updown_randsuspend(AXIS_Y, 550,5000,1);
}
}
how i can put this is the effects on my cube??
0xf2,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,