Nice! Would you mind posting video of the final result?
Apologies for dabbling in code that already works perfectly well, but in my opinion this would be more readable and concise if you were to use arrays to store your pin numbers and current values, something like:
// Random Flicker
#define LEDCOUNT 6
int ledPins[LEDCOUNT] = {3, 5, 6, 9, 10, 11};
int curValue[LEDCOUNT] = {100, 100, 100, 100, 100, 100};
void setup()
{
randomSeed(analogRead(ledPins[0])); // a little trick for getting more random-like behavior
}
void loop()
{
for (int i=0; i<LEDCOUNT; ++i)
{
long rndValue = random(-40, 50);
curValue[i] += rndValue;
if (curValue[i] < 0)
curValue[i] = 0;
else if (curValue[i] > 255)
curValue[i] = 255;
analogWrite(ledPin[i], curValue[i]);
delay(50);
}
}
Good luck with that!
Mikal