char status;
int multiplier;
//number of frames, you can edit this but make sure to edit the one below as well
int frames = 24;
//each column represents one frame, the number of frames must match the "frames" variable
char pin2[] = "100000001000000010000000";
char pin3[] = "010000000100000001000000";
char pin4[] = "001000000010000000100000";
char pin5[] = "000100000001000000010000";
char pin6[] = "000010000000100000001000";
char pin7[] = "000001000000010000000100";
char pin8[] = "000000100000001000000010";
char pin9[] = "000000010000000100000001";
//each number represents the duration of each frame, you can input a number from 1-9
char time[] = "998877665544332211234567";
//fps will be in milliseconds but will be multiplied with time[]
int fps = 50;
void setup() {
Serial.begin(9600);
for(int i = 2; i <= 13; i++){
pinMode(i, OUTPUT);
}
}
void loop() {
for(int i = 0; i < frames; i++) {
status = pin2[i];
if(status == '1') {
digitalWrite(2, HIGH);
} else if(status == '0') {
digitalWrite(2, LOW);
}
status = pin3[i];
if(status == '1') {
digitalWrite(3, HIGH);
} else if(status == '0') {
digitalWrite(3, LOW);
}
status = pin4[i];
if(status == '1') {
digitalWrite(4, HIGH);
} else if(status == '0') {
digitalWrite(4, LOW);
}
status = pin5[i];
if(status == '1') {
digitalWrite(5, HIGH);
} else if(status == '0') {
digitalWrite(5, LOW);
}
status = pin6[i];
if(status == '1') {
digitalWrite(6, HIGH);
} else if(status == '0') {
digitalWrite(6, LOW);
}
status = pin7[i];
if(status == '1') {
digitalWrite(7, HIGH);
} else if(status == '0') {
digitalWrite(7, LOW);
}
status = pin8[i];
if(status == '1') {
digitalWrite(8, HIGH);
} else if(status == '0') {
digitalWrite(8, LOW);
}
status = pin9[i];
if(status == '1') {
digitalWrite(9, HIGH);
} else if(status == '0') {
digitalWrite(9, LOW);
}
multiplier = time[i] - '0';
Serial.println(0b1000);
delay(fps*multiplier);
}
}