Good look-up table for LED brightness

I have the RGB LED shield with super-bright color LED's. I was looking for a good translation table of pulse width (analogWrite on the PWM pins) for it.
I have found a good formula and made a little function based on it. Below is the C program and the resulting table. The LED brightness output looks linear and as smooth as real Guiness.

Just do "analogWrite(_ledTable(color))" instead of "analogWrite(color)"

/* Pulse width to brightness tables. Calculated with X=2.5
for(int i = 0, j = 1; i < 256; i++, j++) {
int v = (int)(pow((double)i / 255.0, X) * 255.0 + 0.5);
if(v == 0 && i > 0) // Have 0 only for 0, at least 1 for anything above
v = 1;

printf("%3d, ", v);
if(j % 16 == 0 && j > 1)
printf("\n");
}
*/
byte _ledTable[256] = {
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4,
4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8,
8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14,
14, 15, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 22,
22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, 32,
33, 33, 34, 35, 36, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 45,
46, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78,
80, 81, 82, 83, 85, 86, 87, 89, 90, 91, 93, 94, 95, 97, 98, 99,
101, 102, 104, 105, 107, 108, 110, 111, 113, 114, 116, 117, 119, 121, 122, 124,
125, 127, 129, 130, 132, 134, 135, 137, 139, 141, 142, 144, 146, 148, 150, 151,
153, 155, 157, 159, 161, 163, 165, 166, 168, 170, 172, 174, 176, 178, 180, 182,
184, 186, 189, 191, 193, 195, 197, 199, 201, 204, 206, 208, 210, 212, 215, 217,
219, 221, 224, 226, 228, 231, 233, 235, 238, 240, 243, 245, 248, 250, 253, 255 };

im confused by this...why not:

for(int x=0; x<256; x++
{
analogWrite(3,x);
delay(15);
}
for(int x=0; x<256; x++
{
analogWrite(3,x);
delay(15);
}

Me too!

im confused by this...why not:

Because brightness vs. duty cycle is not a linear relationship.

brightness vs. duty cycle is not a linear relationship.

AWOL Please elaborate.

Your eye's response to brightness is non linear so you use gamma correction to even it out. I posted something similar at the beginning of the week. It would make more sense to use PROGMEM to store the look up table though.
http://arduino.cc/forum/index.php/topic,97389.0.html

What is there to elaborate?
Increasing duty cycle from 1 to 26% does not necessarily give a 25% increase in brightness.

ok AWOL

Thanks EVP got the concept from your other post.