Ok, I've dropped frame (I didn't realise that was a 'thing')
I've also looked into the suggestions and got in a bit deep.
It's all to do with creating animations on charlie-plexed LEDs. A lot of the animations are simple to do with loops and counters, some of the more precise ans detailed animations need to be written frame by frame.
The array is a ring of 16 LEDs stacked 8 rings high.
My idea is to write these frames as simple as possible, sending an array of three digit numbers to the function, the first of each 3 digit number is the ring level (vcc out) and the second number is the column number (gnd in)
What about this idea?
void loop(){
thisFunction(000101102203215); //5 LED's to alternate
}
void thisFunction(int thisString){
thisFunctionTimer = millis();
while(millis() - thisFunctionTimer < thisFunctionTime){
for(int i = 0;i < thisString.length() / 3;i ++) {
digitalWrite(thisString.substring(i * 3, 1) + 17, HIGH);
digitalWrite(thisString.substring(i * 3 + 1 , 2), LOW);
digitalWrite(thisString.substring(i * 3, 1) + 17, LOW);
digitalWrite(thisString.substring(i * 3 + 1 , 2), HIGH);
}
}
}
Unless I've got the math wrong, this should do the following for the length of time the frame needs to run.
digitalWrite(17, HIGH);
digitalWrite(0, LOW);
digitalWrite(17, LOW);
digitalWrite(0, HIGH);
digitalWrite(18, HIGH);
digitalWrite(1, LOW);
digitalWrite(18, LOW);
digitalWrite(1, HIGH);
digitalWrite(18, HIGH);
digitalWrite(2, LOW);
digitalWrite(18, LOW);
digitalWrite(2, HIGH);
digitalWrite(18, HIGH);
digitalWrite(3, LOW);
digitalWrite(18, LOW);
digitalWrite(3, HIGH);
digitalWrite(18, HIGH);
digitalWrite(15, LOW);
digitalWrite(18, LOW);
digitalWrite(15, HIGH);
This way I can write a each frame in the animation with only one line.
Or is there a better idea?