This was an RGB Led breakout example connected to our mbed LPC1768 board, we used a common anode type. here is a picture of the module, you could of course use an RGB led and 3 resistors instead

Red connected to Pin 23
Green connected to pin 22
Blue connected to pin 21

The code example simply cycles through the 3 colours
Code
#include "mbed.h"
DigitalOut redLed(p23);
DigitalOut greenLed(p22);
DigitalOut blueLed(p21);
int main()
{
while(1)
{
redLed = 0;
greenLed = 1;
blueLed = 1;
wait(1);
redLed = 1;
greenLed = 0;
blueLed = 1;
wait(1);
redLed = 1;
greenLed = 1;
blueLed = 0;
wait(1);
}
}
Links