sparkfun 7262 color sensor

Hi all
I am using sparkfun color sensor 7262 , I have a problem in calibration , i want to get R, G, B values which varies between 0 to 255 but the sensor gives me very high numbers more than 255 so I used map function using the values of calibrated samples with an industrial laboratory spectrometer the samples I used for calibration is white cloth R,G,B = 41,41,41 and black cloth sample R,G,B = 219,222,224
float RR=map(R, 11,484, 41,219);
float GG=map(G, 15,687, 41,222);
float BB=map(B,11,452, 41,224);

When I test after calibration the sensor gives the correct values for black and white but the problem is when the sensor used to read any other colors it gives wrong values
for example (blue) sample its true values 63,116,167 sensor values 51,67,104
(Pink ) sample its true values 183, 110, 118 sensor values 190,80,73

https://learn.sparkfun.com/tutorials/as726x-nirvi/all

code :

#include "AS726X.h"

AS726X sensor;
byte GAIN = 0;
byte MEASUREMENT_MODE = 3;
void setup() {
sensor.begin(Wire, GAIN, MEASUREMENT_MODE);
Serial.begin(9600);
}

void loop() {
sensor.enableBulb();
// sensor.setBulbCurrent(3);
sensor.setIndicatorCurrent(0);
sensor.setIntegrationTime(210);
sensor.setBulbCurrent(0);
sensor.takeMeasurements();

float B = sensor.getBlue();
float G = sensor.getGreen();
float R = sensor.getRed();
float RR=map(R, 11,484, 41,219); //
float GG=map(G, 15,687, 41,222); //
float BB=map(B,11,452, 41,224); //

Serial.print(RR);
Serial.print(" ");
Serial.print(GG);
Serial.print(" ");
Serial.print(BB);
Serial.println(" ");
}

You will probably need to apply gamma correction for all three primary colours as read by the sensor.

Another thing to try is using constrain() to limit results from RGB channels to be within the black/white calibration range before doing the map().

hi Riva

i try make constrain() to limit values but still same problem

thanks for reply

I have had a slightly better look at the AS726x and your code.
Are you using the same light source for the AS7262 and the lab spectrometer?
What do you get reading calibrated values instead of basic values?
Have you tried the Adafruit library to see if it returns the same results?
AFAIK map() does not work with float values.
How do you combine the VBGYOR into just RGB?