I copied a slight piece of the code. because we have a lot of animations but then it will be to long.
we also use normaly progmem instead of normal mem
but because we had this issue from the start i don't think its an issue with something like that.
i expect a timings issue but i wont understand where and why.
Output with serial monitor is
Start Setup
Start Loop
Start Loop
Start Loop
Start Loop
Start Loop
Start Loop
Start Loop
Start Loop
Start Loop
Start Loop
Start Loop
Start Loop
Start Loop
Start Loop
Start Loop
Start Loop
Start Loop
int DataPin = 11; //shift input
int LatchPin = 10; //rstclk on shift
int ClockPin = 13; //srclk on shift
int clock = 9; //decade clk
int Reset = 8; //reset
int x; //used in the for loop counter
int y; //used in the for loop counter
unsigned char light [][8][3] = {
{{63,255,252},{127,255,254},{255,255,255},{255,231,255},{255,231,255},{127,195,254},{127,129,254},{30,0,120}},
{{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}}};
unsigned char vis [][8][3] = {
{{8,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
{{8,0,0},{8,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
{{8,0,0},{8,0,0},{8,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
{{8,0,0},{8,0,0},{8,0,0},{8,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
{{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0},{0,0,0},{0,0,0},{0,0,0}},
{{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0},{0,0,0},{0,0,0}},
{{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0},{0,0,0}},
{{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0}},
{{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0},{255,255,255}},
{{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0},{255,255,255},{255,255,255}},
{{8,0,0},{8,0,0},{8,0,0},{8,0,0},{8,0,0},{255,255,255},{255,255,255},{255,255,255}},
{{8,0,0},{8,0,0},{8,0,0},{8,0,0},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{8,0,0},{8,0,0},{8,0,0},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{8,0,0},{8,0,0},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{8,0,0},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{255,255,255},{255,255,255},{255,255,255},{127,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{255,255,255},{255,255,255},{71,255,255},{3,255,255},{71,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{255,255,255},{255,255,255},{163,255,255},{129,255,255},{163,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{255,255,255},{255,255,255},{209,255,255},{192,255,255},{209,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{255,255,255},{255,255,255},{209,255,255},{192,255,255},{209,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{255,255,255},{232,255,255},{224,127,255},{232,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{244,127,255},{240,63,255},{244,127,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{250,63,255},{248,31,255},{250,63,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{253,31,255},{252,15,255},{253,31,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{254,143,255},{254,7,255},{254,143,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{255,71,255},{255,3,255},{255,71,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{255,163,255},{255,129,255},{255,163,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{255,209,255},{255,192,255},{255,209,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{255,232,255},{255,224,127},{255,232,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{255,244,127},{255,240,63},{255,244,127},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{255,255,255},{255,250,63},{255,248,31},{255,250,63},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{255,255,255},{255,255,255},{255,253,31},{255,252,15},{255,253,31},{255,255,255},{255,255,255},{255,255,255}},
{{255,255,255},{255,255,255},{255,255,255},{255,254,143},{255,254,7},{255,254,143},{255,255,255},{255,255,255}},
{{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,71},{255,255,3},{255,255,71},{255,255,255}},
{{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,163},{255,255,129},{255,255,163}},
{{255,255,253},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,209},{255,255,192}},
{{127,255,252},{255,255,254},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,232}},
{{127,255,252},{255,255,254},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,248}},
{{0,0,0},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{0,0,0},{0,0,0},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{0,0,0},{0,0,0},{0,0,0},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{0,0,0},{0,0,0},{0,0,0},{0,0,0},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{255,255,255},{255,255,255},{255,255,255}},
{{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{255,255,255},{255,255,255}},
{{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{255,255,255}},
{{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}}};
//e.g unsigned char your_new_animation [][8][3] = {
//You can only have a limited amount of frames even if they are in different animations.
//If you have to many frames, the code won't start on the arduino, so you will have to reduce the amount of them.
//An animation can be played an unlimited amount of times but it can only hold so much data.
void setup(){
Serial.begin(115200);
Serial.println("Start Setup");
pinMode(DataPin,OUTPUT); //Basic setup of pins etc
pinMode(ClockPin,OUTPUT);
pinMode(LatchPin,OUTPUT);
pinMode(clock,OUTPUT);
pinMode(Reset,OUTPUT);
digitalWrite(Reset,HIGH); //Reseting the decade to 0 as it can be at a random stage on start up
delayMicroseconds(5);
digitalWrite(Reset,LOW);
}
void run_animation(unsigned char frame_time,unsigned char frames[][8][3],unsigned char num_frames,unsigned char num_loops){ //My function called run_animation
for(int i=0;i<num_loops;i++){ //The display algorithm shifts out the 3 numbers in the array to display row 1 and then drops down a line....
for(x=0;x<num_frames;x++){ //and continues to output the data for that line. It drops down through each of the 8 rows then resets. It then does the next frame.
for(int z=0;z<frame_time;z++){
for(y=0;y<8;y++){
digitalWrite(LatchPin, 0);
shiftOut(DataPin, ClockPin,LSBFIRST,frames[x][y][2]);
shiftOut(DataPin, ClockPin,LSBFIRST,frames[x][y][1]);
shiftOut(DataPin, ClockPin,LSBFIRST,frames[x][y][0]);
digitalWrite(LatchPin, 1);
delayMicroseconds(700);
digitalWrite(LatchPin, 0);
shiftOut(DataPin, ClockPin,MSBFIRST,0);
shiftOut(DataPin, ClockPin,MSBFIRST,0);
shiftOut(DataPin, ClockPin,MSBFIRST,0);
digitalWrite(LatchPin, 1);
digitalWrite(clock, 1);
digitalWrite(clock, 0);
}
digitalWrite(Reset, 1);
digitalWrite(Reset, 0);
}
}
}
}
void loop(){
Serial.println("Start Loop");
//Fill in this to call each of your animations: run_animation(frame time, animation title, number of frames in the animation, number of loops);
//e.g. run_animation(8,your_new_animation,11,12);
run_animation(4,vis,47,2);
run_animation(4,light,2,200);
}