We are using this sensor in this example
We will connect the Red, Green and blue connections up to the following port pins C0, C1 and C2
Then we will send the respective pin high (1) and switch the selected colour on.
Code
#include <16F877A.h>
#fuses XT, NOWDT, NOLVP, NOPROTECT
#use delay (clock=4M)
void main()
{
//Set the Port D to 0.
set_tris_D(0x00);
//Infinite loop.
while(1)
{
//LED Pins connect to C0, C1 and C2
//Set pins individually high to change colours
output_c(0x01);
delay_ms(500);
output_c(0x02);
delay_ms(500);
output_c(0x04);
delay_ms(500);
output_c(0x00);
delay_ms(500);
}
}