int proxcont;
proxcont = sonar[1].ping_cm();
int colorchange;
colorchange = sonar[0].ping_cm();
}
This code was a complete waste of effort typing it. It accomplishes absolutely nothing.
nblendBrightnessTowardBrightness( currentBrightness, targetPalette, maxChanges);
Why are you blending currentBrightness to targetPalette?
delay(1); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
That is NOT what that code does.
delay(1);
I just want to scream "You f**king moron", when someone complains that their code is slow, when it littered with crap like this. But, I won't.
int colorchange;
colorchange = sonar[0].ping_cm();
You do not appear to be aware that you can declare AND value a variable in one statement. It's time you became aware.
It's also long past time that you learned about scope.