Color Sensing with TCS3200, Need Help with Code & Understanding

Johan_Ha:
If you write R = 124 to the rerminal, you pass 124 as the arg v1.

Hmm, I'm not too sure what you mean.

Here's the code, just toying around with passing "frequency" into function. What needs to be changed?

#define S0 4
#define S1 5
#define S2 6
#define S3 7
#define sensorOut 8
#define RGBLEDR 10
#define RGBLEDG 11
#define RGBLEDB 12

int frequency = 0;
void setup() {
pinMode(S0, OUTPUT);
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
pinMode(S3, OUTPUT);
pinMode(sensorOut, INPUT);
pinMode(RGBLEDR, OUTPUT);
pinMode(RGBLEDG, OUTPUT);
pinMode(RGBLEDB, OUTPUT);

// Setting frequency-scaling to 20%
digitalWrite(S0,HIGH);
digitalWrite(S1,LOW);

Serial.begin(9600);
}
void loop() {
// Setting red filtered photodiodes to be read
digitalWrite(S2,LOW);
digitalWrite(S3,LOW);
// Reading the output frequency
frequency = pulseIn(sensorOut, LOW);
//Remaping the value of the frequency to the RGB Model of 0 to 255
frequency = map(frequency, 25,72,255,0);
LEDColor(frequency,frequency,frequency);
// Printing the value on the serial monitor
Serial.print("R= ");//printing name
Serial.print(frequency);//printing RED color frequency
Serial.print(" ");
delay(300);
// Setting Green filtered photodiodes to be read
digitalWrite(S2,HIGH);
digitalWrite(S3,HIGH);
// Reading the output frequency
frequency = pulseIn(sensorOut, LOW);
//Remaping the value of the frequency to the RGB Model of 0 to 255
frequency = map(frequency, 30,90,255,0);
LEDColor(frequency,frequency,frequency);
// Printing the value on the serial monitor
Serial.print("G= ");//printing name
Serial.print(frequency);//printing RED color frequency
Serial.print(" ");
delay(300);
// Setting Blue filtered photodiodes to be read
digitalWrite(S2,LOW);
digitalWrite(S3,HIGH);
// Reading the output frequency
frequency = pulseIn(sensorOut, LOW);
//Remaping the value of the frequency to the RGB Model of 0 to 255
frequency = map(frequency, 25,70,255,0);
LEDColor(frequency,frequency,frequency);
// Printing the value on the serial monitor
Serial.print("B= ");//printing name
Serial.print(frequency);//printing RED color frequency
Serial.println(" ");
delay(300);
}

void LEDColor(int v1, int v2, int v3) {
analogWrite(RGBLEDR,v1);
analogWrite(RGBLEDG,v2);
analogWrite(RGBLEDB,v3);

}