That's great to hear, and you should be proud of yourself! Not many people hang-on to figure things out!
Making RunningLights faster can be tricky, since the sin calculation is probably the only thing that chews up most of the consumed time.
void RunningLights(byte red, byte green, byte blue, int WaveDelay) {
int Position=0;
for(int i=0; i<NUM_LEDS*2; i++)
{
Position++; // = 0; //Position + Rate;
for(int i=0; i<NUM_LEDS; i++) {
setPixel(i,((sin(i+Position) * 127 + 128)/255)*red,
((sin(i+Position) * 127 + 128)/255)*green,
((sin(i+Position) * 127 + 128)/255)*blue);
}
showStrip();
delay(WaveDelay); // <-- this line
}
}
The fastest, with this code, would be by removing the indicated line.
But you will probably not gain much with that, if anything at all (since you already used WaveDelay=0).
To make the sin calculations faster, you could create an array with pre-calculated values.
So create an array of integers 0 - NUM_LEDS, and fill it with the values "sin" would have produced.
Maybe this can be as simple as the following code.
Note:
- I've stored most of the calculation (the common part) in the array (in setup(), since we only want to do this once, and keep reusing the values)
- I have no idea how much faster this will be, and if it's even faster (I assume it will be faster though)
...
int SinValues[NUM_LEDS];
...
void setup() {
...
for (int 1=0; i<NUM_LEDS; i++) { // populate array with numbers
SinValues = ((sin(i+Position) * 127 + 128)/255);
}
...
}
...
void RunningLights(byte red, byte green, byte blue, int WaveDelay) {
int Position=0;
for(int i=0; i<NUM_LEDS*2; i++)
{
Position++; // = 0; //Position + Rate;
for(int i=0; i<NUM_LEDS; i++) {
setPixel(i,SinValues*red,
SinValues*green,
SinValues*blue);
}
showStrip();
delay(WaveDelay);
}
}
Hope this helps ...