Physics demo.

I'm trying to make a demonstration tool to show how red, green, and blue light can be combined in different amounts to achieve pretty much any color.

Ideally I would like to have three potentiometers. Each one controlling it's own leg of an RGB led. But using the code I wrote, and the configuration of my components I get nothing from the led.

RGB led datasheet:
http://rsk.imageg.net/graphics/uc/rsk/Support/ProductManuals/2760028_DS_EN.pdf

I concocted this code using a LillyPad tutorial as an example:
http://web.media.mit.edu/~leah/LilyPad/06_rgb_code.html

int anodePin = 13; 

int redPin = 2;
int bluePin = 4;
int greenPin = 6; 

int rpotPin = 0;
int gpotPin = 1;
int bpotPin = 3;

int rval = 0;
int gval = 0;
int bval = 0;

int red = 0;
int green = 0;
int blue = 0;

int r = 0;
int g = 0;
int b = 0;

void setup()        
{        
         pinMode(anodePin, OUTPUT);     // sets the anodePin to be an output
         pinMode(redPin, OUTPUT);       // sets the redPin to be an output
         pinMode(greenPin, OUTPUT);       // sets the greenPin to be an output
         pinMode(bluePin, OUTPUT);       // sets the bluePin to be an output
}        
         
void loop()       // run over and over again
{        
          rval = analogRead(rpotPin);    // read the value from the potentiometer
          gval = analogRead(gpotPin);    // read the value from the potentiometer
          bval = analogRead(bpotPin);    // read the value from the potentiometer

          red = map(rval, 0, 1023, 0, 255);      // maps the potentiometer reading to led 
          green = map(gval, 0, 1023, 0, 255);    // maps the potentiometer reading to led
          blue = map(bval, 0, 1023, 0, 255);     // maps the potentiometer reading to led
          
          r = map(red, 0, 255, 255, 0);          // maps led anode values to cathode values 
          g = map(green, 0, 255, 255, 0);        // maps led anode values to cathode values
          b = map(blue, 0, 255, 255, 0);         // maps led anode values to cathode values
          
          color(r, g, b);                         // sends code to led
        }        
         
void color (unsigned char red, unsigned char green, unsigned char blue)     // the color generating function
{        
          analogWrite(r, 255-red);        
          analogWrite(g, 255-blue);
          analogWrite(b, 255-green);
}

I'm pretty sure I not only have issues in my program, but also in my understanding of how the RGB led itself works. Any help, or suggestions would be greatly appreciated.

The first thing I noticed is that you are not writing to your pins...

oid color (unsigned char red, unsigned char green, unsigned char blue)     // the color generating function
{
          analogWrite(r, 255-red);
          analogWrite(g, 255-blue);
          analogWrite(b, 255-green);
}

You might try...

analogWrite(redPin, 255-red);
          analogWrite(bluePin, 255-blue);
          analogWrite(greenPin, 255-green);

Hope it helps,

Sasha